简体   繁体   中英

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

$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

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

it is not calling up ActiveTag function

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. It evaluates variable names against scope inside automatically, no need for the {{}}.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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