本文整理匯總了TypeScript中@angular/forms.FormBuilder類的典型用法代碼示例。如果您正苦於以下問題:TypeScript FormBuilder類的具體用法?TypeScript FormBuilder怎麽用?TypeScript FormBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FormBuilder類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(fb: FormBuilder) {
this.options = fb.group({
hideRequired: false,
floatPlaceholder: 'auto',
});
}
示例2: constructor
constructor(fb: FormBuilder) {
this.myForm = fb.group({
"sku" : ["", Validators.required]
});
}
示例3: constructor
constructor(fb: FormBuilder) {
this.options = fb.group({
'color': 'primary',
'fontSize': [16, Validators.min(10)],
});
}
示例4: constructor
constructor(formBuilder: FormBuilder) {
this._formBuilder = formBuilder;
this.formGroup = formBuilder.group({});
}
示例5: constructor
constructor(fb:FormBuilder) {
this.myForm = fb.group({
'username' : [''],
'userid': ['']
})
}
示例6: updateForm
/**
* Update the form values
* @param values
*/
updateForm(values:Object = {}) {
this.metricForm = this.fb.group({
name: [this.selectedMetric.name || '', Validators.required]
});
}
示例7: ngOnInit
ngOnInit() {
this.myForm = this.formBuilder.group({
radio: 'C'
});
}
示例8: createForm
/**
* Creates the forms for the Motion and the MotionVersion
*/
public createForm(): void {
this.contentForm = this.formBuilder.group({
selectedParagraphs: [[], Validators.required],
reason: ['', Validators.required]
});
}
示例9: it
it('should create controls from a boxed value', () => {
const g = b.group({'login': {value: 'some value', disabled: true}});
expect(g.controls['login'].value).toEqual('some value');
expect(g.controls['login'].disabled).toEqual(true);
});
示例10: setUpForm
private setUpForm() {
this.form = this.formBuilder.group({
email: [null, [Validators.required, Validators.email]],
password: [null, Validators.required]
});
}