Sujeet Raman

Sujeet Raman

  • 864
  • 927
  • 352.9k

How to get Id and Value from a dropdwn in angular 2?

Feb 14 2018 4:03 AM
i have a dropdown like
 
<select [(ngModel)]="car.Marketid" required name="Marketid" id="Marketid" ngModel class="form-control">
<option [ngValue]="select" disabled [selected]="true">--Select Market--</option>
<option *ngFor="let code of names" value="{{code.marketId}}">{{code.marketName}} - {{code.SpecMarketCode}}</option>
</select>
 
in my "save" methode in ts  i need to get Markrtid which i selected from this dropdown and MarketName but here  [(ngModel)]="car.Marketid" so im getting only id in my save methode in ts file. i need to get marketname also
how can i get? 

Answers (2)