jQuery .submit() replacement with angular?

余生长醉 提交于 2019-12-14 03:13:38

问题


Is there angular event trigger function, like we have with jQuery for following action?

$('.link').click(function () {
    $('form').submit(); // this will submit form 
});

Please note, that this is not onSubmit function which is mostly <form ng-submit="submit()"/>


回答1:


You can use ng-click to call a function in your controller to execute form submission.

$('form').submit()

using jQuery

or

document.getElementById('someForm').submit()

using JavaScript



来源:https://stackoverflow.com/questions/33508617/jquery-submit-replacement-with-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!