1

I wanna have a predefined input form that has the value for the email provider. I case is not modify, on submit, it should upload to firebase the gmail.com value but it dosen't upload anything unless I delete the value from the input form and rewriting.

<input class="button" value="gmail.com" formControlName="emailProvider">

Can someone tell what should I modify to work?

2 Answers 2

2

Template Driven Forms:

<input class="button" [(ngModel)]="value">

class MyComponent {
  value = 'gmail.com'
}

Reactive Forms:

<input class="button" [formControl]="ctrl">

class MyComponent {
  ctrl = new FormControl('gmail.com');
}
Sign up to request clarification or add additional context in comments.

Comments

2

I think this might do the trick:

1) Remove the value property from your input;

2) When creating the emailProvider FormControl in your FormGroup instantiation, set the former's initial value to "gmail.com"

emailProvider: new FormControl('gmail.com')

By doing so, the initial value of the FormControl will be 'gmail.com' and should be able to be overridden by the user's input.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.