Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Android hardware back button in ionic 2

$
0
0

@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 platform
registerBackButtonAction 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

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>