angularjs - Why does ng-click not work in case-1, but does in case-3? -
there fundamental im not yet understanding.
im trying make user of modal module in angular ui.bootstrap im finding clicks not activating open()
function -- boiling down simple testcase, below, im not seeing calls when ng-click points function (alert or console.log), work when ng-click points expression
why alert
not called in first example?
<div data-ng-app> <button data-ng-click="alert('message 1');"> ngclick -- not working, why not? </button> <button onclick="alert('message 2');"> plain onclick </button> <button data-ng-click="count = (count + 1)"> works, why ??? </button> count: {{count}} </div>
ng-click
meant use either function in current scope (so example $scope.alert = window.alert
solve problem of not being able alert there) or angular expression. looks angular not allow use global scope methods in there (it might looking them in current $scope
, missing).
Comments
Post a Comment