formarray

angular6-json-schema-form issue with multi-select form change event

家住魔仙堡 提交于 2019-12-24 08:36:40
问题 The current implementation for multi-select doesn't show <mat-select [formControl]="toppings" multiple> because here for type 'array' and 'enum' it shows 'checkboxes'. So, I have overridden that behavior in the following way: myCustomWidgets = { submit: NoneComponent, checkboxes: CustomMultiSelectComponent }; I have created a MaterialSelectComponent file which is a copy of the same file from 'angular6-json-schema-form' and then added the custom widget like below. <json-schema-form

How to get index of changed item in angular form array

空扰寡人 提交于 2019-12-20 10:32:24
问题 I'm using Angular 4 with reactive forms. I have a form array that I am trying to tie to an array I keep track of in my component. I'm using reactive forms so I can have the validation, so I don't want to use the template forms approach. I add items to the form array like so: createFormWithModel() { this.orderForm = this.fb.group({ orderNumber: [this.order.ProductBookingOrder], orderDate: [this.order.PurchaseOrderIssuedDate], lineDetailsArray: this.fb.array([]) }) const arrayControl =

disable FormGroup by using Validators

早过忘川 提交于 2019-12-20 05:42:07
问题 I had formArray checkbox on my checkboxForm , I need to disabled button submit if no checkbox are checked , I had implement custom validator on my checkboxForm , this is what I had tried; Ts file get formReceivedSummons() { return this.checkboxForm.get('receivedSummons') as FormArray; } ngOnInit() { this.checkboxForm = this.formBuilder.group({ receivedSummons: this.formBuilder.array([]) }); this.getReceivedSummons(); } getReceivedSummons() { this.receivedSummonsSubscription = this

disable FormGroup by using Validators

只谈情不闲聊 提交于 2019-12-20 05:42:01
问题 I had formArray checkbox on my checkboxForm , I need to disabled button submit if no checkbox are checked , I had implement custom validator on my checkboxForm , this is what I had tried; Ts file get formReceivedSummons() { return this.checkboxForm.get('receivedSummons') as FormArray; } ngOnInit() { this.checkboxForm = this.formBuilder.group({ receivedSummons: this.formBuilder.array([]) }); this.getReceivedSummons(); } getReceivedSummons() { this.receivedSummonsSubscription = this

Angular 5 FormArray get data from database and show rows

拈花ヽ惹草 提交于 2019-12-19 11:24:09
问题 I am just a newbie to angular. I have create a event component where user enters the event name with packages. When user creates an event it has the functionality for creating multiple packages with add and remove row. For that I have used FormArray . Everything is fine here. But when I am trying to get those values in event edit component I am getting the value of event name but when I am trying to get the packages details I am little bit confused in showing rows with filled values. Here is

Nested dynamic array forms in Angular Reactive forms

心已入冬 提交于 2019-12-13 17:43:48
问题 I'm having a array form namely "address" and this will be a dynamic once the user clicks the "Add Address" button immediately one address form will add. I implemented this with an issue (Add/Remove address works fine). Now I need to add a dynamic contact numbers similar like address. A address may contain one or more than one phone numbers, if the user clicks "Add Phone number" need to add a new phone number form inside the address form, the functionality will required in all the address

how to get selected value of dropdown in reactive form

对着背影说爱祢 提交于 2019-12-13 03:19:31
问题 I am trying to get the selected value of the dropdown on change event to be sent on reactive form submission. I have a very similar scenario working for radio based on the answer from how to get selected value of radio in reactive form Here's the code for dropdown <div class="row" *ngIf="question.controls.type.value === 'dropdown'"> <div class="col-md-12"> <div class="form-group__text select"> <label for="type">{{ question.controls.label.value }}</label> <br><br> <select name="value"

Getting issue in registering contorl with form in Angular Reactive forms

白昼怎懂夜的黑 提交于 2019-12-13 02:48:05
问题 I am working on Angular Reactive forms. Initially I have an formarray in formgroup. afterwards I push formgroup into formarray to add form control dynamically. I am getting an issue when binding these control using formControlName. I am getting this Error: Cannot find control with path: 'controlArray -> 0 -> value' here is my component class code: ngOnInit(){ this.reviewForm = this.fb.group({ 'controlArray': new FormArray([]) }); this.showDefaultForm(); } First I am getting data in formsDb,

How to populate a form with array of data in Angular2?

本小妞迷上赌 提交于 2019-12-12 09:59:09
问题 The SO question below helped me setup a formbuilder, proper validation, and a dynamic set of input fields from a formBuilder Array. How to assign and validate arrays to forms in Angular2 Note this solution code http://plnkr.co/edit/YoqdBEo0MihaxdhHH1FV?p=preview Everything works great on a new form, but I get stuck when trying to populate said form from the database. I'm using the following code and initialValue has multiple emails saved from this form in a previous transaction. All my other

angular 4 nested formArray Cannot find control with path: 'segmentRows3 -> 1 -> segmentId3'

試著忘記壹切 提交于 2019-12-11 14:22:10
问题 I cannot push to an array. I have a segment(id, time) that can have one or several people (role, infos). The field are generated dynamically. On load the page shows the fields (see image below). When try to add a segment I get error : ERROR TypeError: Cannot find control with path: 'segmentRows3 -> 1 -> segmentId3' Here is code from the .ts file: addSegment() { let segmentRows3 = this.mySummaryForm.get('segmentRows3') as FormArray; segmentRows3.push(this.fb.array([ this.fb.group({