2017-02-16 10 views
1

私はアプリに外部Webページを含める必要がありますので、iframeを使用します。 これで、読み込み中のアニメーションが表示され、iframeが読み込まれます。それは正常に動作しますが、iframeが準備完了しているときにアニメーションを解除する方法はわかりません。 iframeのページのコードを編集できません。活字体-ファイルに私のコードですIonic 2:iframeの準備ができたらアニメーションを読み込みません。

ngOnInit() { 
    this.presentLoading(); 
} 

presentLoading() { 
    let loading = this.loadingCtrl.create({ 
     content: 'Please wait...' 
    }); 

    loading.present(); 
} 

とHTMLファイル

<ion-content> 
    <iframe name="chatFrame" src="http://..."></iframe> 
</ion-content> 
+0

私はこの質問はここに答えたかもしれないと考えている:[インラインフレーム上の負荷状態をチェック](http://stackoverflow.com/questions/17158932/ iframeがすでにロードされているかどうかを検出する方法/ 36155560#36155560) –

答えて

1

は、あなたの読み込みアニメーションを解任する関数へのonLoadのiframe方法を取り付けます。

<ion-content> 
    <iframe name="chatFrame" src="http://..." (load)="dismissLoading()"></iframe> 
</ion-content> 

そして、あなたのコンポーネントクラス中:

loading; 

ngOnInit() { 
    this.presentLoading(); 
} 

presentLoading() { 
    this.loading = this.loadingCtrl.create({ 
     content: 'Please wait...' 
    }); 

    loading.present(); 
} 

dismissLoading(){ 
    this.loading.dismiss(); 
} 
関連する問題