2
我正在嘗試使用操作屬性進行簡單的登錄表單工作。這裏的問題是請求/登錄永遠不會發送。通過開發工具在DOM中複製和粘貼表單使複製的工作。 Angular似乎阻止了表單的默認行爲。Angular 2表單在提交時不發送操作請求
這裏是我的登錄表單組件,非常簡單:
@Component({
selector: 'my-app',
template: `
<form #f="ngForm" action="/login" method="POST">
Username: <input type="text"required>
<br/>
Password: <input type="password" required>
<br/>
<button type="submit">Login</button>
</form>
`,
directives: [FORM_DIRECTIVES]
})
我也試圖在ngSubmit
指令的處理程序返回true
/false
但它不工作過。
這是說明問題的plunker。
任何人都知道如何告訴角度提交表單與動作請求?
angular.2.0.0-Beta.1
事實上,我使用手冊'f.submit()'作爲解決方法,但'ngNoForm'很多更好!謝謝。希望會有所幫助。 – VPusher