本文整理匯總了TypeScript中@angular/forms/src/model.FormArray.push方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript FormArray.push方法的具體用法?TypeScript FormArray.push怎麽用?TypeScript FormArray.push使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/forms/src/model.FormArray
的用法示例。
在下文中一共展示了FormArray.push方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: setTimeout
data.cor_dataset_actor.forEach((cor, index) => {
if (index === 0) {
this.cor_dataset_actor_array.controls[index].patchValue(cor);
} else {
const formCor = this._formService.generateCorDatasetActorForm();
this.cor_dataset_actor_array.push(formCor);
//hack pour attendre que le template soit rendu avant de mettre les valeurs au formulaire
setTimeout(() => {
this.cor_dataset_actor_array.controls[index].patchValue(cor);
}, 2000);
}
});
示例2: ngOnInit
ngOnInit() {
// get the id from the route
this._route.params.subscribe(params => {
this.id_dataset = params['id'];
if (this.id_dataset) {
this.getDataset(this.id_dataset);
}
});
this.datasetForm = this._fb.group({
id_acquisition_framework: [null, Validators.required],
id_dataset: null,
dataset_name: [null, Validators.compose([Validators.required, Validators.maxLength(150)])],
dataset_shortname: [
null,
Validators.compose([Validators.required, Validators.maxLength(30)])
],
dataset_desc: [null, Validators.required],
id_nomenclature_data_type: [null, Validators.required],
keywords: null,
marine_domain: true,
terrestrial_domain: false,
id_nomenclature_dataset_objectif: [null, Validators.required],
//TODO bouding-box
id_nomenclature_collecting_method: [null, Validators.required],
id_nomenclature_data_origin: [null, Validators.required],
id_nomenclature_source_status: [null, Validators.required],
id_nomenclature_resource_type: [null, Validators.required],
default_validity: true,
active: [true, Validators.required]
});
this.cor_dataset_actor_array = this._fb.array([]);
this._dfs.getAcquisitionFrameworks().subscribe(data => {
this.acquisitionFrameworks = data;
});
this.cor_dataset_actor_array.push(this._formService.generateCorDatasetActorForm());
}
示例3: addFormArray
addFormArray(): void {
this.cor_dataset_actor_array.push(this._formService.generateCorDatasetActorForm());
}