how to pass angular js variable inside onclick function as parameter

前端 未结 9 1634
一生所求
一生所求 2020-12-15 20:37

I have tried to pass AngularJS variable as argument value inside onclick() to call javascript function. Can anyone guide me on how to do it?

My code:

9条回答
  •  离开以前
    2020-12-15 21:08

    I had a case where I could not use ng-click due to window binding. Did not get direct answer but the below did work for me. I know it is not a good solution but workable in my case.

    angular.element(this).scope().ctrlName.variable

    You can try using your own class structure. So the click will be as below:

    onclick="test(angular.element(this).scope().ctrlName.ObjName.variable)"

提交回复
热议问题