javascript - Call Angular-function upon $scope-variable change -
i new angularjs , trying set function gets called upon whenever variable changed.
currently have dropdown-menu, ng-model bound $scope.userrating. , trying function gets called when user changes value using dropdown.
i have been looking @ $watch, not quite sure on how work. tried make ng-click function on in html, ng-clicks don't seem trigger.
you should use $watch . example-
$scope.$watch('modalvarible',function(newval,oldval){ //do code }
here on change of variable 'modalvarible' watch called.
Comments
Post a Comment