How to manually trigger a form's submit in AngularJS?

前端 未结 5 927
感动是毒
感动是毒 2020-12-30 02:34

I have a form that I wanted be nested, but it is not possible since HTML can\'t accept nested form. Is there a way I can manually invoke the submit(triggers the validation,

5条回答
  •  隐瞒了意图╮
    2020-12-30 02:52

    We can always submit a form directly using the submit () function from javascript.

    document.getElementById("myform").submit()
    

    In this way, we can validate the form using angularjs first and if the form is valid then submit it using the submit method.

提交回复
热议问题