How can I copy an object and lose its reference in Angular?
With AngularJS, I can use angular.copy(object), but I\'m getting some error using that in An
angular.copy(object)
Assuming you are using ES6, you can use var copy = Object.assign({}, original). Works in modern browsers; if you need to support older browsers check out this polyfill
var copy = Object.assign({}, original)
update:
With TypeScript 2.1+, ES6 shorthand object spread notation is available:
const copy = { ...original }