Open DarioN1 opened 6 years ago
Hi, I have to manage a classic list of countries. The country is an information that I have to manage in a Customer Profile component...
The code I have implemented is this:
In typescript for fill the options:
this.dataServiceCountry = this.completerService.local(this.listCountry, 'nameLong', 'nameLong');
In typescript to get the id of the country:
onCountrySelected(item: CompleterItem) { this.customer.idCountry = item ? item.originalObject.idCountry : null; }
Then in component:
<ng2-completer id="idCountry" inputClass="form-control input-sm" [ngModelOptions]="{standalone: true}" textNoResults="Not Found" [datasource]="dataServiceCountry" [minSearchLength]="0" (selected)="onCountrySelected($event)"></ng2-completer>
I can properly get the value and use it to save the record in database.
Now I want that when I load the customer profile, the ng2-completer is set to the properly value...
How to do it ? Thanks to support
Hi, were you able to figure this out? I am having same problem, not sure how to populate the value for existing value coming from DB.
Hi, I have to manage a classic list of countries. The country is an information that I have to manage in a Customer Profile component...
The code I have implemented is this:
In typescript for fill the options:
this.dataServiceCountry = this.completerService.local(this.listCountry, 'nameLong', 'nameLong');
In typescript to get the id of the country:
Then in component:
I can properly get the value and use it to save the record in database.
Now I want that when I load the customer profile, the ng2-completer is set to the properly value...
How to do it ? Thanks to support