angular - Unable to route from on page component to another page -
i new in angular 2,i using ng2-admin template in angular 2.0.0 version. want route pages component if user logged in route dashboard page.currently using "route.navigate(['dashboard'])" after call function gives me error undefined routes. following component side code: 
please me out, thanks
you have import { routermodule, routes } '@angular/router'; , have declare routes below in app.ts or main.ts:
const routes: routes = [ { path: '', redirectto: '/dashboard', pathmatch: 'full' }, { path: 'dashboard', component: dashboardcomponent }, ]; @ngmodule({ imports: [ routermodule.forroot(routes) ], exports: [ routermodule ] }) then can use routes in corresponding component below:
this.router.navigate(['/dashboard']); adding new function:
gotodashboard() { console.log("coming"); console.log(this); this.router.navigate(['/dashboard']); } and call in response => {this.gotocrises()}.



Comments
Post a Comment