0
を更新していない購読:私はにErrorMessageAngular2がAtferイベントのdivは、私が問題を抱えている
// HTML
<div [(hidden)]="!errorMessage" class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<strong>Error</strong> {{ errorMessage }}
</div>
//コンポーネント
ngOnInit(){
this.authService.authenticated.subscribe(result => {
if(result){
this.navigateToHome();
}
});
this.authService.authenticationError.subscribe(message => {
this.errorMessage = message;
this.showError(message);
console.log(message);
})
}
をrednerしたいビューの 今問題:errorMessageは2度目の起動時にのみ表示されます。 コンソールには毎回メッセージが表示されますが、divは毎秒の要求を更新するだけです。 ハンドラは常に呼び出されます!
私はプロパティをデコレートしました:@Output()public errorMessage:string;
はそれdoesntのは任意のアイデアを助けるように見えますか?
こんにちは、イムは、それだけで2番目の要求に取り組んでngIf使用した場合でも:( – Skary