0
レポートを保存するNGRXエフェクトがあります。レポートを保存した後、フォームをリセットしてレポートが保存されたという通知を表示します。NGRXエフェクト後のハンドルアクション
以下は、レポートを保存して店舗に注入するエフェクトをディスパッチするストアの例です。
保存して挿入した後、フォームをリセットしてユーザーに通知する必要があります。
onSubmit(): void {
// Gather the fields from the form and
// dispatch the new report event which will
// save the report and insert it into the store
const formModel = this.reportForm.value;
this.store.dispatch(new AddReport(formModel));
// After the report is saved, reset the form and
// display a notification to the user it was saved
this.reportForm.markAsPristine();
this.snackbar.open('Report Saved!', null, { duration: 700 });
}
問題は、私が唯一のフォームをリセットして、レポートをバックエンドによって保存された場合に通知を表示したいです。これを達成するための最良の方法は何ですか?
どのようにuはコンポーネントのアクションにそのFormSubmitSuccessを翻訳しまう書を提出するために効果が書き込まれることがありますどのように? – amcdnl
こちらの回答はあなたの質問に答えますか? https://stackoverflow.com/questions/43226681/how-to-subscribe-to-action-success-callback-using-ngrx-and-effects/43227548 – Meeker
これは私が探していたものです。 – amcdnl