I am pretty new to Angular and have a requirement where I need to read the selected value from a drop-down list and send the selected value to a component while routing. Can som
Here is the solutions for both your questions:
Solution to your first question binding dropdown:
Component:
import { Component } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
constructor(private route: Router){ }
selectedLevel;
data:Array
HTML:
Drop Down
{{selectedLevel | json}}
Here is a working DEMO
Solution to your second question To send Params to Route:
From Component:
this.route.navigate(['schedulemanagement/autoStartStopVm/' + data]);
So, selected function will be,
selected(){
console.log(this.selectedLevel)
this.route.navigate(['schedulemanagement/autoStartStopVm/' + data]);
}
From HTML:
Person