當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript FormGroup.addControl方法代碼示例

本文整理匯總了TypeScript中@angular/forms.FormGroup.addControl方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FormGroup.addControl方法的具體用法?TypeScript FormGroup.addControl怎麽用?TypeScript FormGroup.addControl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/forms.FormGroup的用法示例。


在下文中一共展示了FormGroup.addControl方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: ngOnInit

  ngOnInit() {
    this.EditForm = this._fb.group({});

    const title = new FormControl();
    title.setValidators([Validators.required]);
    this.EditForm.addControl('title', title);

    const subtitle = new FormControl();
    subtitle.setValidators([Validators.required]);
    this.EditForm.addControl('subtitle', subtitle);

    const detail = new FormControl();
    detail.setValidators([Validators.required]);
    this.EditForm.addControl('detail', detail);

    const tag = new FormControl();
    tag.setValidators([Validators.required]);
    this.EditForm.addControl('tag', tag);

  }
開發者ID:littlestrong26,項目名稱:RealWorld,代碼行數:20,代碼來源:edit.component.ts

示例2: setParagraph

 /**
  * Called by the template when a paragraph is clicked in single paragraph mode.
  * Behaves like a radio-button
  *
  * @param {ParagraphToChoose} paragraph
  */
 public setParagraph(paragraph: ParagraphToChoose): void {
     this.contentForm.value.selectedParagraphs.forEach(para => {
         this.contentForm.removeControl('text_' + para.paragraphNo);
     });
     this.contentForm.addControl(
         'text_' + paragraph.paragraphNo,
         new FormControl(paragraph.rawHtml, Validators.required)
     );
     this.contentForm.patchValue({
         selectedParagraphs: [paragraph]
     });
 }
開發者ID:CatoTH,項目名稱:OpenSlides,代碼行數:18,代碼來源:amendment-create-wizard.component.ts

示例3:

        Object.keys(controls).forEach((controlName, idx) => {

            let controlModel = models[idx];

            if (formModel instanceof DynamicFormGroupModel) {
                formModel.insert(index, controlModel);

            } else {
                (formModel as DynamicFormControlModel[]).splice(index, 0, controlModel);
            }

            formGroup.addControl(controlName, controls[controlName]);
        });
開發者ID:thanhdevapp,項目名稱:ng-dynamic-forms,代碼行數:13,代碼來源:dynamic-form.service.ts

示例4: ngOnInit

    public ngOnInit() {
        this.control = new FormControl(
            "",
            Validators.compose([
                Validators.required,
                this.keyFormatValidator,
                this.keyTypeValidator.bind(this),
                this.originMatchValidator.bind(this),
            ])
        );

        this.form.addControl("key", this.control);
    }
開發者ID:chrisduong,項目名稱:habitat,代碼行數:13,代碼來源:KeyAddFormComponent.ts

示例5: FormControl

 .forEach( question => form.addControl(question.key, new FormControl('')));
開發者ID:yeg-relief,項目名稱:screenerClient,代碼行數:1,代碼來源:question-control.service.ts

示例6: FormControl

 this.formConfig.forEach(controlConfig => {
   this.form.addControl(controlConfig.name, new FormControl());
   this.buildControl(controlConfig);
 });
開發者ID:niralmunjariya,項目名稱:angular-dynamic-forms,代碼行數:4,代碼來源:form-renderer.component.ts

示例7: ngOnInit

 ngOnInit() {
   this.form = new FormGroup({});
   this.form.addControl('quantity', new FormControl(1, [this.validateQuantity]));
 }
開發者ID:skycoin,項目名稱:skycoin,代碼行數:4,代碼來源:number-of-addresses.ts

示例8: ngOnInit

 /**
  * Component being initialized.
  */
 ngOnInit(): void {
     // Always set confirmdatasaved to 1. Sending the data means the user accepted.
     this.form.addControl('confirmdatasaved', this.fb.control(1));
 }
開發者ID:SATS-Seminary,項目名稱:moodlemobile2,代碼行數:7,代碼來源:offlineattempts.ts

示例9:

 prop.propertyMap.forEach(name => {
     const control = fb.control(0)
     control.setParent(this.boxModel)
     this.boxModel.addControl(name, control)
 })
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:5,代碼來源:layout-pane.component.ts

示例10: FormGroup

const questionOne = new FormGroup({
  key: new FormGroup({
    name: new FormControl('boolean_key'),
    type: new FormControl('boolean')
  }),
  label: new FormControl('question label'),
  controlType: new FormControl('Toggle'),
  id: new FormControl('fake_id'),
  index: new FormControl(0),
  options: new FormControl([]),
  conditionalQuestions: new FormControl([]),
  expandable: new FormControl(false)
});

const form = new FormGroup({});
form.addControl('fake_id', questionOne);


const screenerState: fromScreener.State  = {
  loading: false,
  form: form,
  error: '',
  selectedConstantQuestion: 'fake_id',
  selectedConditionalQuestion: undefined,
  keys: [
    {name: 'boolean_key', type: 'boolean'},
    {name: 'integer_key', type: 'integer'}
  ],
  created: 0
};
開發者ID:yeg-relief,項目名稱:screenerClient,代碼行數:30,代碼來源:screener-toolbar.component.spec.ts


注:本文中的@angular/forms.FormGroup.addControl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。