Angular 9 反应式表单在提交时重新加载路由。

问题描述 投票:0回答:1

我正在Angular 9中创建反应式表单。我有几个字段,如名字,姓氏,电子邮件等。我使用表单生成器映射了所有的东西,表单控件名称在html和ts中都有。我使用ng提交来提交表单,而且我没有给任何按钮类型(因为默认情况下它会采用提交类型)。我试图将数据保存在JSON文件中,然后我就会订阅结果。 但是当我试图在subscribe()中导航到另一个路径时,每次页面都在重载。

我使用JSON服务器将数据保存在JSON文件中。

请你帮助我如何防止这种情况发生?先谢谢你:)

下面是代码。enter image description here

.ts文件

enter image description here

服务.tsenter image description here

angular angular-material angular-routing angular-reactive-forms json-server
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.