Angular 2 this.router.navigate is not working -


actually trying navigate main component login component after 2 database request(post , put). not working.

constructor(private service:service, private router:router){}  select(solution:string, size:string) {     let obj1 = {};     let obj2 = {}      this.service       .newobj(obj1)       .subscribe(         (data) => {this.service.status(obj2, data._id).subscribe((data) =>**this.router.navigate(['/login'])**);           console.log('data.id', data._id)},         error => console.log('could not post data.'));   } 

i think intended navigate through url segment, 'login', should use navigatebyurl instead:

this.router.navigatebyurl('/login') 

Comments