0
私はtypscriptでAngular2アプリケーションを持っています。私は、私は、ファイルがパスに存在しない場合に例外を生成したい、@Input
としてそのファイルを受信した音声タグを、持っている:音声タグのハンドル404エラー
HTMLは次のとおりです。
<div>
<audio controls autoplay id="audio" (error)="audioError()">
<!--source src="horse.ogg" type="audio/ogg"-->
<source [src]="fileToPlay" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</div>
コンポーネントは次のとおりです。
export class PlayComponent implements OnChanges {
@Input() fileToPlay:string;
audioError(){
console.log('out of range');
}
}
onerror
を使用しようとしましたが動作しません。
まだ動作しません。私は私の質問を更新しました。 @Pankaj Parkar – Salman