且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AngularJS $ http.post请求已被Chrome取消

更新时间:2022-06-24 06:41:51

如果 action 参数,Angular将不会 preventDefault()已设定。请参见此处

Angular will not preventDefault() if the action parameter is set. See here


出于这个原因,Angular会阻止默认操作(表单提交到服务器),除非该元素指定了action属性。

For this reason, Angular prevents the default action (form submission to the server) unless the element has an action attribute specified.

你应该也可以在< form> 上使用 ng-submit =login()而不是 ng-click ,以便在用户按Enter键时提交表单

You should probably also use ng-submit="login() on the <form> instead of ng-click, so that it will submit the form when the user presses Enter