0

I have a project with Angular 2.

I have a formbuilder with field who use Google Places API. Everything works except my field with dropdown after click on element.

The new value is set in the field but value of formbuilder is not.

enter image description here

My function formbuilder :

createFormStep1() {
    this.rideForm = this._formBuilder.group({
        departure: [this.rideModel.departure, [Validators.required]]
        // ...
    });
}

My template :

<aside class="section-form">
        <div class="form-group">

            {{ rideForm.value.departure }}
            <input type="text" #autocomplete (focusout)="onKeyOrigin($event)" class="form-control" formControlName="departure" placeholder="Ville, adresse, métro, gare...">
            <app-control-messages [control]="rideForm.controls.departure"></app-control-messages>
        </div>
    </aside>
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
swagney
  • 3
  • 3
  • I assume you do have a `form`-tag with `[formgroup]="rideForm"`? – AT82 Jan 19 '17 at 11:12
  • Exactly `
    `
    – swagney Jan 19 '17 at 11:36
  • Okay, good, this kind of information could be shown in question, so that people know this without needing to ask :) Could you try to add `[(ngModel)]="ridemodel.departure"` to your input field. Have no idea if it actually makes any difference, but try :) – AT82 Jan 19 '17 at 11:42
  • I have already tried but no change :( Thx for your help – swagney Jan 19 '17 at 13:53

0 Answers0