javascript - change value of submit button onclick with angularjs -


i'm implementing function where, when button clicked, text of button changed works properly. button appears when condition true works perfectly. when button appears when condition true when it's clicked values doesn't change.

 <button ng-if ="item.user == 'login'" class="{{love_default}}" ng-click=" love=!love">{{lovetext}}</button> 

js

$scope.love = true; $scope.love_default = "button button-small button-positive icon icon-left ion-ios-heart"; $scope.$watch('love', function() {     $scope.lovetext = $scope.love ? 'login' : 'already logged in'; }) 

when take out ng-if , click on button works

<button class="{{love_default}}" ng-click=" love=!love">{{lovetext}}</button> 

but want working ng-if applied button


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -