Angular 2: Form submission canceled because the form is not connected

前端 未结 10 742
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 13:03

I have a modal that contains a form, when the modal is destroyed I get the following error in the console:

Form submission canceled because the form i

10条回答
  •  旧巷少年郎
    2020-12-08 13:25

    There might be other reasons this occurs but in my case I had a button that was interpreted by the browser as a submit button and hence the form was submitted when the button was clicked causing the error. Adding type="button" fixed the issue. Full element:

        

提交回复
热议问题