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


TypeScript FormGroup.setControl方法代码示例

本文整理汇总了TypeScript中@angular/forms.FormGroup.setControl方法的典型用法代码示例。如果您正苦于以下问题:TypeScript FormGroup.setControl方法的具体用法?TypeScript FormGroup.setControl怎么用?TypeScript FormGroup.setControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/forms.FormGroup的用法示例。


在下文中一共展示了FormGroup.setControl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: setObjectives

 setObjectives() {
   /* const objectives = this.board.selectObjectives
     .map(o => { return { organizationId: o.organization.id, objective: o.objective }}); */
   const objectiveFGs = this.board.selectObjectives.map(o => this.fb.group(o));
   const objectiveFormArray = this.fb.array(objectiveFGs);
   this.form.setControl('selectObjectives', objectiveFormArray);
 }
开发者ID:wolfhoundjesse,项目名称:AMI,代码行数:7,代码来源:edit-board.component.ts

示例2: ngOnInit

 public ngOnInit() {
     const collection: any[] = this.csConfig[this.csDefinition.propertyName];
     if (this.csDefinition.keyPropertyName) {
         this.collectionForms.setValidators(uniqueKey(this.csDefinition.keyPropertyName));
     }
     collection.forEach((value, i) => {
         this.collectionForms.setControl(i, this.formBuilder.group({}));
     });
     this.parentForm.setControl(this.csDefinition.propertyName, this.collectionForms);
     this.collection = collection;
 }
开发者ID:PjMitchell,项目名称:ConfigServer,代码行数:11,代码来源:collection-input.component.ts

示例3: setupForm

    private setupForm() {
        let collection: string[] = this.csConfig[this.csDefinition.propertyName];
        if (!collection) {
            collection = new Array<string>();
        }

        collection.forEach((value, i) => {
            this.collectionForms.setControl(i, this.buildControl(value));
        });
        this.parentForm.setControl(this.csDefinition.propertyName, this.collectionForms);
        this.collection = collection;
        if (this.csDefinition.validationDefinition && !this.csDefinition.validationDefinition.allowDuplicates) {
            this.collectionForms.setValidators(uniqueItem());
        }
    }
开发者ID:PjMitchell,项目名称:ConfigServer,代码行数:15,代码来源:string-collection-input.component.ts

示例4: populateClubsForm

 private populateClubsForm(clubs): void {
   const newClubsArray: FormArray = this.fb.array([]);
   this.clubs.map((club: Club) => {
     const clubControl: FormControl = this.fb.control(club);
     const nameControl: FormControl = this.fb.control(club.clubName, [
       Validators.required,
       Validators.minLength(3),
       Validators.maxLength(250),
       this.existingClubName()
     ]);
     const group: FormGroup = this.fb.group({
       name: nameControl,
       club: clubControl
     });
     newClubsArray.push(group);
   });
   this.clubsForm.setControl('clubs', newClubsArray);
 }
开发者ID:PloughingAByteField,项目名称:tiatus,代码行数:18,代码来源:clubs.component.ts


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