Answer the question
In order to leave comments, you need to log in
Redirect in Angular 2?
Hello. There are 2 components. InfoComponent and DetailsComponent. There is also a standard AppComponent. I use routers.
{path: 'info', component: InfoComponent},
{path: 'details', component: DetailsComponent}
If(date.hour > 4 && date.hour < 10) // <--- к примеру
router.navigate(['info'])
Answer the question
In order to leave comments, you need to log in
Use canActivate https://angular.io/docs/ts/latest/guide/router.htm...
Check the condition, redirect to the correct url and return false.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question