[英]angular local variable binding from http response
I just wanted to know is there any way to bind variables without bind each other. 我只想知道有什么方法可以绑定变量而不相互绑定。
this.commissions = res.Data;
this.oldCommissions = res.Data;
When I changed a 'Price' value of this object this.commissions
当我更改此对象的“价格”值时,
this.commissions
this.oldCommissions
also change 'Price' value. this.oldCommissions
还会更改“价格”值。
How can I avoid this is anybody knows that? 我怎么能避免这是任何人都知道的?
this.commissions =angular.copy(res.Data);
this.oldCommissions =angular.copy(res.Data);
I am guessing you want to try angular's deep copy funtionality where both variables do not point to the same index. 我猜想您想尝试在两个变量都不指向同一索引的情况下使用angular的深度复制功能。 Please find link for the same - https://docs.angularjs.org/api/ng/function/angular.copy# !
请找到相同的链接-https://docs.angularjs.org/api/ng/function/angular.copy# !
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.