I am trying to use the following code to subscribe, but it does not work.
import { Platform } from 'ionic-angular'; @Page({ templateUrl: 'build/pages/test.html', }) export class Test{ constructor(private platform: Platform) { this.platform.pause.subscribe(() => { console.log('paused') }); } }
I am using Ionic 2 with TypeScript, Angular 2. Since platform.pause is an EventEmitter provided by Ionic 2, I assume that it should be signed. However, when I put the application in the background, console.log('pause') does not start.
Should I add Platform to providers or something like that? In addition, this platform is not null . this.platform.ready().then(()=>{console.log('ready')}) works fine.
angular ionic-framework ionic2
Zhipeng yang
source share