本文整理汇总了TypeScript中@angular/forms.FormBuilder.group方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FormBuilder.group方法的具体用法?TypeScript FormBuilder.group怎么用?TypeScript FormBuilder.group使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/forms.FormBuilder
的用法示例。
在下文中一共展示了FormBuilder.group方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(private _fb: FormBuilder) {
this.form = this._fb.group({
username: ['', Validators.compose([Validators.required, UsernameValidator.cannotContainSpace]), UsernameValidator.shouldBeUnique],
password: ['', Validators.required]
});
}
示例2: it
it('should create controls from a value', () => {
const g = b.group({'login': 'some value'});
expect(g.controls['login'].value).toEqual('some value');
});
示例3: ngOnInit
ngOnInit() {
this.form = this.formBuilder.group({
username: ['', Validators.required],
password: ['', Validators.required]
});
}
示例4: ngOnInit
ngOnInit(){
this.form = this._form.group({ key: ['', Validators.required] });
}
示例5: constructor
constructor(fb: FormBuilder) {
this.myForm = fb.group({
'sku': ['ABC123']
});
}
示例6: it
it('#should fail when 2 amounts are given', () => {
let group = { valueAddedTax: ['1'], priceInclVat: ['2'], priceWoVat: [''] };
let controlGroup = formBuilder.group(group);
let validationResult = AmountValidator.validate(controlGroup);
expect(validationResult).toEqual(failResult);
});
示例7: ngOnInit
ngOnInit() {
this.getShows();
this.showsForm = this.formBuilder.group({
'model': null
});
}
示例8: buildForm
buildForm(): FormGroup {
return this.fb.group({
title: ['', [Validators.required]],
description: ['', [Validators.required]]
});
}
示例9: constructor
constructor(public settings: SettingsService, fb: FormBuilder, private router: Router) {
this.valForm = fb.group({
email: [null, Validators.compose([Validators.required, Validators.email])]
});
}