Quantcast
Channel: User Just code - Stack Overflow
Viewing all articles
Browse latest Browse all 41

Answer by Just code for Dynamically adding routerlink for a button from a Select option's value

$
0
0

Use ngmodel variable inside routerlink like this

<div class="center"><div class="form-group"><label>Select Country</label><select class="form-control" [(ngModel)]="selectedOption"><option *ngFor="let o of options" [value]="o.value">{{o.name}} </option></select>  <button><a [routerLink]="selectedOption">Submit</a></button>{{selectedOption}}</div></div>

demo


Viewing all articles
Browse latest Browse all 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>