當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。