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


TypeScript FormArray.push方法代码示例

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


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

示例1: it

      it('should support inserting', () => {
        a.push(c1);
        a.push(c3);

        a.insert(1, c2);

        expect(a.controls).toEqual([c1, c2, c3]);
      });
开发者ID:manekinekko,项目名称:angular,代码行数:8,代码来源:form_array_spec.ts

示例2: it

      it('should support clearing', () => {
        a.push(c1);
        a.push(c2);
        a.push(c3);

        a.clear();

        expect(a.controls).toEqual([]);

        a.clear();

        expect(a.controls).toEqual([]);
      });
开发者ID:Cammisuli,项目名称:angular,代码行数:13,代码来源:form_array_spec.ts

示例3: adaptFormArraySize

export function adaptFormArraySize(formArray: FormArray, size: number, elementProducer: (index: number) => AbstractControl) {

    while (formArray.length !== size) {
        if (formArray.length > size) {
            formArray.removeAt(0);
        } else if (formArray.length < size) {
            formArray.push(elementProducer(formArray.length));
        }
    }
}
开发者ID:hmenager,项目名称:composer,代码行数:10,代码来源:form-array-helpers.ts

示例4: addPayOff

  addPayOff(event) {
    event.preventDefault(); // ensure this button doesn't try to submit the form
    const emptyPayOff = {amount: null, date: null, final: false};

    // add pay off to both the model and to form controls because
    // I don't think Angular has any way to do this automagically yet
    this.myModel.payOffs.push(emptyPayOff);
    this.payOffsFormArray.push(this.createPayOffFormGroup(emptyPayOff));
    console.log('Added New Pay Off', this.payOffsFormArray);
  }
开发者ID:screenm0nkey,项目名称:angular2-examples-webpack,代码行数:10,代码来源:form-9.ts

示例5: inject

         inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
           a.removeAt(1);

           a.valueChanges.subscribe({
             next: (value: any) => {
               expect(value).toEqual(['old1', 'old2']);
               async.done();
             }
           });

           a.push(c2);
         }));
开发者ID:manekinekko,项目名称:angular,代码行数:12,代码来源:form_array_spec.ts

示例6: hinzufuegen

    hinzufuegen() {
        const waehrungsbetrag = new FormGroup({
            betrag: new FormControl('', Validators.required),
            waehrung: new FormControl('EUR', Validators.required)
        });

        const group = new FormGroup({
            kategorie: new FormControl('', Validators.required),
            position: new FormControl('', Validators.required),
            waehrungsbetrag: waehrungsbetrag,
        });

        this.positionen.push(group);
    }
开发者ID:haschi,项目名称:dominium,代码行数:14,代码来源:gruppe.component.ts


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