I have import :
import { RouterModule, Routes} from '@angular/router';
and then I have used below line in my function inside component
this.router.navigate(['/dashboard']);
I have import :
import { RouterModule, Routes} from '@angular/router';
and then I have used below line in my function inside component
this.router.navigate(['/dashboard']);
Import ActivatedRoute library from angular router.
import {ActivatedRoute, Router} from '@angular/router';
Use following custructor
constructor(private route:ActivatedRoute,private router:Router) { }
And Call navigate method
this.router.navigate(['/page2'])
Error: Property 'route' does not exist on type 'Component'
Add Modules : import{ActivatedRoute} from '@angular/router'; import { Router } from '@angular/router';
constructor (private route:ActivatedRoute,private router:Router){} Code Implementation:
this.memberService.getmember(this.route.snapshot.paramMap
.get('name')).subscribe(member=>{
this.member=member
})
}