javascript - Model changes not updating the view -


i have button listening click event , idea toggle state when button clicked.

the view :

<button  ng-click="nextbtnclicked()" ng-disabled="{{state == 1}}" class="btn">call</button> 

the controller :

app.controller('workstation',['$scope',function($scope) {     $scope.state = 0;     $scope.nextbtnclicked = function()     {        $scope.state = 1;     }; }] 

the problem don't see changes when button clicked.i've tried execute $apply() got error "error:[$rootscope:inprog]"

you don't need use interpolation.

use:

ng-disabled="state == 1" 

otherwise:

ng-disabled="{{state == 1}}" 

will evaulated into:

ng-disabled="false" 

which means ngdisabled directive watching variable named false on associated scope.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -