How to adding navigation bar button having ionic-o

2019-09-14 21:20发布

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条回答
乱世女痞
2楼-- · 2019-09-14 21:58

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>
查看更多
登录 后发表回答