How to adding navigation bar button having ionic-on/ ionic-off functionality

淺唱寂寞╮ 提交于 2019-12-25 02:57:41

问题


I want to add star button on navigation bar and when user press on this, the button show selected icon and next time is press it show unselected. I tried it by using ionic-on and ionic-off but I can't make it.


回答1:


The icon-on and icon-off attributes only apply to tabs I think. You can use ng-class like you see here. Based on the value of your $scope.starred property, it will show a star or the outline of a star.

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


来源:https://stackoverflow.com/questions/29841253/how-to-adding-navigation-bar-button-having-ionic-on-ionic-off-functionality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!