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

前端 未结 10 753
被撕碎了的回忆
被撕碎了的回忆 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:06

    In the form tag you should write the following:

     

    and inside the form you should have submit button:

     
    

    And most importantly, if you have any other buttons in your form you should add type="button" to them. Leaving the default type attribute (which I think is submit) will cause the warning message.

    
    

提交回复
热议问题