Create deep copy in angular 2

Just use the following function :

/**
 * Returns a deep copy of the object
 */

public deepCopy(oldObj: any) :any {
    var newObj = oldObj;
    if (oldObj && typeof oldObj === "object") {
        newObj = Object.prototype.toString.call(oldObj) === "[object Array]" ? [] : {};
        for (var i in oldObj)
            newObj[i] = this.deepCopy(oldObj[i]);
    }
    return newObj;
}

Try to use the Lodash.js . Because angular 2 does not have any method for deep copy . for reference see :https://lodash.com/docs#cloneDeep

or You can use this javascript function

var copy = Object.assign({}, myObject);