0
子供から親コンポーネントに渡すデータがあります。空であるか、自動的に値があるかどうかをチェックします。@outputを使って子供から親コンポーネントにデータを送信
これは私のlogin.compunent.tsである - これが私のapp.compunentである親TS
emailData:string;
onUpdate(userEmail:string){
console.log("userEmail")
if(userEmail !== ''){
this.emailData = userEmail
console.log(userEmail)
}
}
- 子供はこれが私のapp.compunent.tsである
@Output() update=new EventEmitter<string>();
userEmail = "[email protected]";
authUser(loginForm) {
this.update.emit(userEmail);
this.router.navigate(['/home']);
}
をtsは。 HTML - parernt HTML
{{emailData}}
<router-outlet (update)="onUpdate($event)"></router-outlet>
こんにちは用セッターを実装し、その後一定の場合をフィルタリングし、@SebOlensはご説明をお願いいたします。 – KUROYUKI