从AngularJS
1.3开始,有一个新方法称为
$watchGroup观察一组表达式。
$scope.foo = 'foo';$scope.bar = 'bar';$scope.$watchGroup(['foo', 'bar'], function(newValues, oldValues, scope) { // newValues array contains the current values of the watch expressions // with the indexes matching those of the watchexpression array // i.e. // newValues[0] -> $scope.foo // and // newValues[1] -> $scope.bar });
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)