Why does ng-click not work in case-1, but does in case-3?

后端 未结 5 2122
误落风尘
误落风尘 2020-12-29 20:16

There is clearly something fundamental im not yet understanding.

Im trying to make user of the Modal module in Angular Ui.Bootstrap but im finding that my clicks are

5条回答
  •  暖寄归人
    2020-12-29 20:53

    For that to work, you have to define alert on your $scope:

    $scope.alert = function(text) {
        alert(text);  
    };
    

    Relevant piece from documentation:

    AngularJS restricts access to the Window object from within expressions since it's a known way to execute arbitrary Javascript code.

    https://docs.angularjs.org/error/$parse/isecwindow

提交回复
热议问题