field not update after click dropdown angular 2

假装没事ソ 提交于 2020-01-07 02:41:05

问题


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.

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>

来源:https://stackoverflow.com/questions/41739968/field-not-update-after-click-dropdown-angular-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!