reactive-forms

How to throw validation message, when there is some change in the edit item using angular8

送分小仙女□ 提交于 2020-02-16 10:41:53
问题 The bounty expires in 12 hours . Answers to this question are eligible for a +50 reputation bounty. Bhrungarajni is looking for an answer from a reputable source : “I would give 50 reputation of my own if i get proper answer to this question” I am using reactive forms formArray to add the section of data on click of add, and on click of edit, after editing i have used delete and save button to save to the table. So basically one operation at a time must be done. So, when i click on edit, Add

How to throw validation message, when there is some change in the edit item using angular8

懵懂的女人 提交于 2020-02-16 10:40:04
问题 The bounty expires in 12 hours . Answers to this question are eligible for a +50 reputation bounty. Bhrungarajni is looking for an answer from a reputable source : “I would give 50 reputation of my own if i get proper answer to this question” I am using reactive forms formArray to add the section of data on click of add, and on click of edit, after editing i have used delete and save button to save to the table. So basically one operation at a time must be done. So, when i click on edit, Add

How to dynamically add inputs value to angular component?

烂漫一生 提交于 2020-02-06 08:03:02
问题 I am getting array of questions that i am populating sequentially in modal window so inputs i have in formGroup are based on questions , SO i am trying to assign values as you can see formatSubQuestions method when everytime sinle question answer submitted using getNextQuestion . The problem is CURRENT_TEXT always come empty string and TEXT_NUMBER and TEXT_DATE always have same values. Only ALLERGY_DETAILS always get correct values. All these inputs may not be part of same question. What is

How to dynamically add inputs value to angular component?

三世轮回 提交于 2020-02-06 08:02:06
问题 I am getting array of questions that i am populating sequentially in modal window so inputs i have in formGroup are based on questions , SO i am trying to assign values as you can see formatSubQuestions method when everytime sinle question answer submitted using getNextQuestion . The problem is CURRENT_TEXT always come empty string and TEXT_NUMBER and TEXT_DATE always have same values. Only ALLERGY_DETAILS always get correct values. All these inputs may not be part of same question. What is

Error alerts in angular reactive forms appear one step late

最后都变了- 提交于 2020-01-24 12:08:12
问题 I am using Angular 8 and I am trying to create a registration form with reactive forms. I had created some alert messages to show validation errors. However, the previous alert is shown instead of the current alert! (one step late) app.component.ts file: import { Component } from '@angular/core'; import { FormBuilder, Validators, FormControl } from '@angular/forms'; @Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export class

Custom Component MdDatePicker used in reactive Form

别来无恙 提交于 2020-01-11 13:15:18
问题 I am trying to create a custom component to be used in a angular formGroup. Here's is how I want to use this custom component: <form [formGroup]="form"> ... <app-date-picker formControlName="dateStart" [isConsultation]="isConsultation" [label]="'Du'" [(ngModel)]="agenda.datDeb"> </app-date-picker> ... </form> Problem : In the main component (containing this form), The model doesn't get updated when the value changes in my custom component, which is involving a MdDatePicker. Though I am using

Custom Component MdDatePicker used in reactive Form

孤街浪徒 提交于 2020-01-11 13:15:09
问题 I am trying to create a custom component to be used in a angular formGroup. Here's is how I want to use this custom component: <form [formGroup]="form"> ... <app-date-picker formControlName="dateStart" [isConsultation]="isConsultation" [label]="'Du'" [(ngModel)]="agenda.datDeb"> </app-date-picker> ... </form> Problem : In the main component (containing this form), The model doesn't get updated when the value changes in my custom component, which is involving a MdDatePicker. Though I am using

Checking Multiple Row Custom Validator in Angular 4 Reactive Forms

[亡魂溺海] 提交于 2019-12-30 14:48:30
问题 I have a very simple problem which I can't get it. First, I have an ingredient which has an approved quantity. And that ingredient has several expiration dates. However, I want to check if my expiration dates which has the "quantity to transfer" is not more than the approved quantity. How should I check this? I already finished some parts BUT this one I couldn't compare since it has to check several rows of "quantity to transfer" against the one approved quantity. Here's the code link below:

ReactiveForm for dynamically updated form entries

淺唱寂寞╮ 提交于 2019-12-26 18:15:28
问题 How to check status of myform in component to check if all the fields are filled or not? HTML: <div [formGroup]="myform"> <div *ngFor="let question of questions"> <label>{{question.question}}</label> <select required > <option selected disabled="disabled">Option</option> <option *ngFor="let option of question['options']">{{option}}</option> </select> </div> </div> </div> Question JSON coming from API: this.questions = [ { question: 'What is your age?', options: ['20', '30', '40'] }, {

ReactiveForm for dynamically updated form entries

空扰寡人 提交于 2019-12-26 18:15:15
问题 How to check status of myform in component to check if all the fields are filled or not? HTML: <div [formGroup]="myform"> <div *ngFor="let question of questions"> <label>{{question.question}}</label> <select required > <option selected disabled="disabled">Option</option> <option *ngFor="let option of question['options']">{{option}}</option> </select> </div> </div> </div> Question JSON coming from API: this.questions = [ { question: 'What is your age?', options: ['20', '30', '40'] }, {