I have a drop down to select countries from a back-end API call.
code:
this.http.get(SERVER_URL+"/edit/getAllCountry")
.subscribe((res) => {
this.countries = res;
});
this will returns me list of countries from my database.
ill be printing them in html like:
billingPage.html
<select [(ngModel)]="country" (ngModelChange)="countryChanged(country)" >
<option *ngFor="let c of countries" [ngValue] = 'c'> {{c.countryName}} </option>
</select>
the question is , before coming to this billing.html page I have a selected value for the country. for example I have selected 'USA' and how can I load it in into to the dropdown when the page is loaded.
in the dropdown list 'USA' should be selected when the page loads.