当前位置: 首页>>代码示例>>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;未经允许,请勿转载。