本文整理匯總了TypeScript中angular2/common.FormBuilder.control方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FormBuilder.control方法的具體用法?TypeScript FormBuilder.control怎麽用?TypeScript FormBuilder.control使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/common.FormBuilder
的用法示例。
在下文中一共展示了FormBuilder.control方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(private fb: FormBuilder, private authService: AuthService, private navController: NavController) {
// Create the form controls
this.userName = fb.control('');
this.password = fb.control('');
this.userForm = fb.group({
username: this.userName,
password: this.password
});
}
示例2: constructor
constructor(fb: FormBuilder) {
this.email = fb.control('', Validators.compose([Validators.required, this.isEmailIppon]));
this.password = fb.control('', Validators.compose([Validators.required, Validators.minLength(3)]));
this.confirm = fb.control('', Validators.compose([Validators.required, Validators.minLength(3)]));
this.passwordForm = fb.group({
password: this.password,
confirm: this.confirm
}, {
validator: this.passwordMatch
});
this.loginForm = fb.group({
email: this.email,
passwordForm: this.passwordForm
});
}
示例3: constructor
constructor(private _apiservice: ApiService, fb: FormBuilder) {
this.userForm = fb.group({
bands: fb.control('', Validators.compose([Validators.required, Validators.minLength(3)])),
date: fb.control('', Validators.required),
price: fb.control('', Validators.required),
venue: fb.control('', Validators.required)
});
this._apiservice
.getGigs()
.subscribe(gigs => this.gigs = gigs,
error => console.log(error),
() => console.log('Gigs loaded in add gig component')
);
}
示例4: onSubmit
onSubmit(event, form: any): void {
console.log('you submitted value:', form);
/*
this.myForm = this.fb.group({
'sku': ['', Validators.required],
'sku1': ['', Validators.required]
});
*/
this.fb.control({
'sku' : ""
})
this.sku = this.myForm.controls['sku'];
this.sku.updateValueAndValidity("");
this.sku.updateValueAndValidity("123");
console.log(this.myForm.controls.sku.value);
this.myForm.controls.sku.value = "Test";
}