ionicNavBarDelegate

Hi everyone,
I’d like to know how could I open Popup when clicking on ion back button, and then on ‘confirm’ tap, load $ionicNavBarDelegate and execute its “back” method.
First part (open popup) is not a pb, but when I do this :

var popup = $ionicPopup.confirm({
	title: 'Mytitle' ,
	template: 'myTemp',
	cancelType: 'button',
	okType: 'button'
	});
	popup.then(function(confirmation) {
		if(confirmation) {
			$ionicNavBarDelegate.back();
		} else {}

and call it on ionic back button touch through a ctrl, I got this error :

TypeError: Illegal invocation
    at deprecatedWarning (http://localhost:8100/lib/ionic/release/js/ionic-angular.js:6173:13)
    at self.back (http://localhost:8100/lib/ionic/release/js/ionic-angular.js:6164:5)
    at http://localhost:8100/lib/ionic/release/js/ionic.js:98:46
    at Array.forEach (native)
    at DelegateInstance.caller [as back] (http://localhost:8100/lib/ionic/release/js/ionic.js:95:27)
    at http://localhost:8100/scripts/controllers/restaurant-menu.js:83:27
    at processQueue (http://localhost:8100/lib/angular/angular.js:13137:27)
    at http://localhost:8100/lib/angular/angular.js:13153:27
    at Scope.$eval (http://localhost:8100/lib/angular/angular.js:14353:28)
    at Scope.$digest (http://localhost:8100/lib/angular/angular.js:14169:31)

Does someone know how invok this method ?
Does someone know how it works exactly ?

thanks,

Sorry, i forgot to say, i’m using ionic 1.0.0-beta.14 and angular 1.3.6

Hi, sorry, i did’nt notice i was on migration between ionic beta 13 and 14, now $ionicHistory has to be used instead of $ionicNavBarDelegate, now it works, thanks

1 Like