本文整理汇总了TypeScript中angular2/common.ControlGroup.addControl方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ControlGroup.addControl方法的具体用法?TypeScript ControlGroup.addControl怎么用?TypeScript ControlGroup.addControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/common.ControlGroup
的用法示例。
在下文中一共展示了ControlGroup.addControl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addDirectionRow
addDirectionRow(event: Event): void {
event.preventDefault();
let name = "direction" + (this.directions.length + 1);
this.recipeForm.addControl(name, new Control("", Validators.required));
this.directions.push(this.recipeForm.controls[name]);
}
示例2: addIngredientRow
addIngredientRow(event: Event): void {
event.preventDefault();
let name = "ingredient" + (this.ingredients.length + 1);
this.recipeForm.addControl(name, new Control("", Validators.required));
this.ingredients.push(this.recipeForm.controls[name]);
}
示例3: generateFormControls
generateFormControls() {
const myForm = new ControlGroup({});
// create headers
const headerGroup = new ControlGroup({});
headerGroup.addControl('acceptControl', new Control());
headerGroup.addControl('yearControl', new Control());
headerGroup.addControl('nameControl', new Control());
myForm.addControl('headerGroup', headerGroup);
// create body
const bodyGroup = new ControlGroup({});
bodyGroup.addControl('titleControl', new Control());
this.itemsControlArray = new ControlArray([]);
bodyGroup.addControl('bodyItemsArray', this.itemsControlArray);
myForm.addControl('bodyGroup', bodyGroup);
// create footer
const footerGroup = new ControlGroup({});
footerGroup.addControl('totalControl', new Control());
footerGroup.addControl('urgentControl', new Control());
myForm.addControl('footerGroup', footerGroup);
return myForm;
}
示例4: ngOnInit
public ngOnInit() {
this.control = new Control(
"",
Validators.compose([
Validators.required,
this.keyFormatValidator,
this.keyTypeValidator.bind(this),
this.originMatchValidator.bind(this),
])
);
this.form.addControl("key", this.control);
}
示例5:
this.operation.parameters.forEach((parameter:ParameterObject) => this.apiDetailForm.addControl(parameter.name,parameter.control));
示例6: ngOnInit
public ngOnInit() {
this.control = new Control("", Validators.required);
this.form.addControl("username", this.control);
}