jgravois jgravois - 2 years ago 134
AngularJS Question

AngularJS: Can't I set a variable value on ng-click?

I have a modal that uses ng-show="prefs" to determine visibility.

My desire is to use the close button in the modal to set $scope.prefs to false and to use an anchor tag to set the value to true. However, all I can find on google uses a checkbox rather than anchor tags.

Is there a way to use ng-click to set a variable to false?

Answer Source

Just do:

ng-click="prefs = false"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download