So I have two components, HomePageComponent and StudentsViewComponent. In HomePageComponent I have a input tag:
<input type="text" #careerObj class="modules" placeholder="Career Objective ( software engineer)">
<button class="submit" routerLinkActive="active" [routerLink]="['/students', careerObj.value ]">Search</button>
and I want to pass the value of this input to studentsViewComponent using params.
It redirects to the correct route, but the param is empty. The value is always empty, and Im not sure why.
Here is my route:
{
path: 'students/:searchQuery',
component: StudentsViewComponent
},
ngOnInit() {
this.activatedRoute.params.subscribe((params: Params) => {
console.log(params);
});
}
not sure why the param is empty.
Please help