8
私は購読するために次のコードを使用しようとしていますが、動作しません。Ionic 2を購読するにはplatform.pause EventEmitter?
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')
});
}
}
私は活字体とイオン2を使用しています、platform.pause
としてアンギュラ2.イオン2が提供持つEventEmitterですが、私はそれを購読することができなければならないと仮定します。しかし、アプリケーションをバックグラウンドに置くと、console.log('pause')
は起動されません。
プロバイダーなどにPlatform
を追加する必要がありますか?さらに、this.platformはnull
ではありません。 this.platform.ready().then(()=>{console.log('ready')})
は完全に機能します。
「機能しません」とはどういう意味ですか?私は 'paused'を印刷しませんでしたか? –
@GünterZöchbauer\t はい、正確です。 –
ここには 'this.platform.pause'とは何が印刷されていませんか?あなたの質問をいくつかのコードで更新するかplunkerで問題を再現できます –