@Muhammedabuali wrote:
Hello all,
in the tutorial for ionic 2 ionic 2 tutorial after clicking on an item the back button closes the app instead of going back to the list page I tried using platformregisterBackButtonAction
but it didn't work. here is the code I tried
import {Page, NavController, NavParams, Platform} from 'ionic-framework/ionic';
import {Inject} from 'angular2/core';
@Page({
templateUrl: 'build/pages/item-details/item-details.html'
})
export class ItemDetailsPage {
constructor(@Inject(NavController) nav, @Inject(NavParams) navParams,
@Inject(Platform) platform) {
this.nav = nav;
// If we navigated to this page, we will have an item available as a nav param
this.selectedItem = navParams.get('item');
this.platform = platform;
console.log(this.platform);
this.platform.registerBackButtonAction(function(){
},500);
// this.platform.onHardwareBackButton(function(e){
// e.preventDefault();
// return true;
// });
}
}
Posts: 1
Participants: 1