我有以下表格:
import { Component } from '@angular/core'
@Component({
selector: 'form1',
template: `
<div >
<form (ngSubmit)="onSubmit(f)" #f="ngForm">
<input ngControl="email" type="text" id="mail" required>
<input ngControl="password" type="text" id="password" required>
<input ngControl="confirmPass" type="text" id="confirmPass" required>
<button type="submit">Submit </button>
</form>
</div> `
})
export class Form1Component{
onSubmit(form:any){
console.log(form.value);
}
}
问题是form.value
只有一个空对象,并且没有ngControl
指令值的迹象。我错过了什么吗?