How to add a navbar button with ion on / ion off function

I want to add a star button to the navigation bar, and when the user clicks on it, the button displays the selected icon, and next time clicks so that it appears unselected. I tried it with ionic include and ion output, but I can't seem to do it.

0


source to share


1 answer


The icon-on

and attributes icon-off

are only applicable to the tabs I think. You can use ng-class

as you see here. Based on the value of your property $scope.starred

, it will show a star or star outline.



<span class="icon" ng-class="{'ion-ios-star': starred, 'ion-ios-star-outline': !starred}"></span>

      

0


source







All Articles