AngularJS: ng-click on img? Manipulating images (kind of gallery-like) with jQuery?

前端 未结 4 1902
暖寄归人
暖寄归人 2021-02-13 00:30

Should ng-click work with img tag ?


myFunction is defined in controller and is $scop

4条回答
  •  野性不改
    2021-02-13 00:56

    I had this issue in case when I used aliases of angularJS. If I wrote something like this:

    function someController($scope) {
        var vm = this;
    
        vm.switchSelected = function (passedEvent) {
        }
    }
    

    and then if in html code to write the following:

    then in order to use switchSelected you need write something like this:

    
    

    so, check did you used

     var vm=this;
    

    in your controller. Then you need to add aliasing to your html part.

提交回复
热议问题