本文整理汇总了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]
});
}