-1
以下の追加機能を呼び出すボタンをクリックすると、データはデータベースに追加されますが、フロントエンド自体には追加されません。ページをロードせずにどのように追加しますか?私はルータを使用している場合角2:ページを読み込まないで追加する方法
addSection(section: Section) {
section.name = section.name.trim();
if(section.name != ''){
this.onToggleDialogBox();
this.sectionService
.registerSection(section)
.subscribe(
res => alert(res.message),
error => console.log(error)
)
}else{
alert('Enter name.');
}
}
、ここで必要なコードは次のとおりです。
constructor(
private router: Router,
private route: ActivatedRoute,
private sectionService: SectionService
) {}
this.router.navigate(['/information/sections']);
'subscribe'関数の' res'では、あなたが望む変更を手作業で行う必要があります。 – SaiUnique
リンクが見つかりません@RahulSingh – Char
はい。それは "ページが見つかりません"と言います@RahulSingh – Char