AngularJs ng-checked using a function

后端 未结 2 1050
面向向阳花
面向向阳花 2020-12-15 08:35

I have a form and I am trying to use a function in input ng-checked=\"someFunction()\" and I don\'t know if this is possible or I am doing something wrong. I ha

2条回答
  •  独厮守ぢ
    2020-12-15 09:04

    What you need to do is use a state variable as the ng-checked expression, eg: ng-checked="someValue". Then it is up to you elsewhere in your code to update that $scope value. The problem is that by using a function, it is unaware when in fact it should update its value.

提交回复
热议问题