简体   繁体   English

Angular JS更新其他单击上的ng-click事件不起作用

[英]Angular JS update ng-click event on other click not working

I want to update argument of ng-click of button but not able to do it please help me... my code is in controller 我想更新按钮的ng-click参数,但无法执行,请帮助我...我的代码在控制器中

$scope.trCategoryId = 0;

and setting up this value in other function like 并在其他功能中设置此值

$scope.setClick = function (CategoryId) {
$scope.trCategoryId = CategoryId;}

in html i have define bellow 在HTML中,我定义了波纹管

<button ng-click="ActiveTag('step1',{{trCategoryId}},0)" id="btnrename">Create</button>

it is not calling up ActiveTag function 它没有调用ActiveTag函数

Glad my comment worked out for you, adding it below as a solution: 很高兴为您解决了我的评论,并在下面添加了它作为解决方案:

Angular related attributes prefaced with ng- auto evaulate so {{trCategoryId}} within any ng- is a no-no. ng-开头的与角度相关的属性ng-自动转义,因此任何ng-中的{{trCategoryId}}都是禁忌。 It evaluates variable names against scope inside automatically, no need for the {{}}. 它自动根据内部作用域评估变量名,无需使用{{}}。

<button ng-click="ActiveTag('step1',trCategoryId,0)" id="btnrename">Create</button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM