I want set tips for ion-nav-buttons when users long click the buttons, just like native apps, but I have no idea, anyone help me?
You could add a dedicated controller to the body of your app and add a generic function to the <ion-nav-buttons>
in there. An example (this just shows the title of the current view on a long press of the back-button but this should give you an idea how to do it):
In index.html:
<body ng-app="MyApp" ng-controller='MainCtrl'> <ion-nav-bar class="bar-positive"> <ion-nav-back-button on-hold="showhelp()"> </ion-nav-back-button> </ion-nav-bar> <ion-nav-view></ion-nav-view> </body>
In controllers.js:
angular.module(‘MyApp.controllers’, )
.controller('MainCtrl', function($scope, $ionicHistory) { $scope.showhelp = function() { alert($ionicHistory.currentTitle()); }
})
here is an example of ionic on-hold
Thank you for replying. The question is that I have used “on-hold” directive but I can not make the tips perform like native apps. I was gonna use “$ionicPopover” to display tips for “ion-nav-buttons”, but ugly.
Thank you for your replying. But I want show tips for “ion-nav-buttons” when users long click them so that users could get the exact meaning of these buttons icon.
Yeah, this is a good idea, I’ll try. Thank you for replying.