title: What is the best way to copy objects in Angular 2?
body: <p>Angular 1.x has methods on the global angular object like angular.copy, angular.shallowCopy (not to mention others like angular.forEach) that don't seem to have an equivalent version in Angular 2. Perhaps it is just not documented. If Angular 2 doesn't intend on providing these utils, what is the best way to get that functionality?</p>
  
  <p>I know I could roll my own shallow copy method using the logic from angular 1.x:</p>
  
  <pre><code>function shallowCopy(src, dst) {
    if (isArray(src)) {
      dst = dst || [];
  
      for (var i = 0, ii = src.length; i &lt; ii; i++) {
        dst[i] = src[i];
      }
    } else if (isObject(src)) {
      dst = dst || {};
  
      for (var key in src) {
        if (!(key.charAt(0) === '$' &amp;&amp; key.charAt(1) === '$')) {
          dst[key] = src[key];
        }
      }
    }
  
    return dst || src;
  }
  </code></pre>
  
  <p>But the deep copy logic is much more complicated (obviously)</p>