Home  >  Forum  >  Angular
Post New Query

State binding in angular at the time of country selection



Asked on September 26, 2019
Hi all,
At the time of creating user in my application ,based on the country selection ,I am loading states in droup down , but at the time of update unable to bind state name in drop down.
I'm using reactive forms 
Angular version 7





Replied on September 26, 2019
Use [selected] to set selected the state name in drop down at run time.

<select formControlName="profile" (change)="onProfileChange()">
	<option [ngValue]="null" disabled>Choose your profile</option>
	<option *ngFor="let prf of allProfiles" [ngValue]="prf" [selected]="prf.prId==='dir'">
		{{ prf.prName }}
	</option>
</select> 

Find the URL that can help you
https://www.concretepage.com/angular/angular-select-option-selected


Write Answer




©2019 concretepage.com | Privacy Policy | Contact Us