$watchGroup can monitor an array or expression.

[AngularJS] AngularJS 1.3 $scope.$watchGroup

We watch both email and password by using the same callback function.

 

    $scope.$watchGroup(['user.email', 'user.password'], function(newVal, oldVal){
        console.log(newVal, oldVal);
    });

 

One thing need to be noticed that, for input type="email", unless you type '@', the $watch won't get fired.

And also, for init, the value would be undefined.

[AngularJS] AngularJS 1.3 $scope.$watchGroup

相关文章:

  • 2022-03-02
  • 2022-12-23
  • 2021-09-22
  • 2021-08-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2021-05-12
  • 2022-12-23
  • 2021-10-24
  • 2022-01-19
  • 2022-02-04
相关资源
相似解决方案