标签: javascript angularjs angularjs-scope
如何将常规javascript变量分配给角度$ scope变量的当前值而不绑定它们的值?
//$scope.var1 is initialized to some value, say 5 var v2 = $scope.var1; //$scope.var1 is changed to 7
我希望v2仍然是5,而不是7。
v2
答案 0 :(得分:1)
var v2 = angular.copy($scope.var1);