当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ControlGroup.addControl方法代码示例

本文整理汇总了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]);
  }
开发者ID:vihanchaudhry,项目名称:pocket-recipes,代码行数:7,代码来源:new-recipe.ts

示例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]);
  }
开发者ID:vihanchaudhry,项目名称:pocket-recipes,代码行数:7,代码来源:new-recipe.ts

示例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;
 }
开发者ID:ranjitjc,项目名称:ts-rxjs-angular2,代码行数:21,代码来源:validation.component.ts

示例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);
    }
开发者ID:davidwrede,项目名称:habitat,代码行数:13,代码来源:KeyAddFormComponent.ts

示例5:

this.operation.parameters.forEach((parameter:ParameterObject) => this.apiDetailForm.addControl(parameter.name,parameter.control));
开发者ID:RGZINC,项目名称:swagger2-angular2-materialize,代码行数:1,代码来源:detail.ts

示例6: ngOnInit

 public ngOnInit() {
     this.control = new Control("", Validators.required);
     this.form.addControl("username", this.control);
 }
开发者ID:cnry,项目名称:habitat,代码行数:4,代码来源:OriginMembersTabComponent.ts


注:本文中的angular2/common.ControlGroup.addControl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。