Answer the question
In order to leave comments, you need to log in
How to add 2 non-SPA pages?
The problem is strange, but please help me to solve it.
1.
In angular6, I made 3 pages with old-style routing (i.e. url with a grid). I achieved this with the help of a feature that the developers of the framework left for backwards compatibility:
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
<a href="/login">Login</a> |
<a routerLinkActive="active"
routerLink="/home">Home</a> |
<a routerLinkActive="active"
routerLink="/catalog">Catalog</a>
<router-outlet></router-outlet>
imports: [
RouterModule.forRoot([
{ path: '', redirectTo: '/login', pathMatch: 'full'},
{ path: 'login', component: LoginViewComponent },
{ path: 'home', component: HomeViewComponent },
{ path: 'catalog', component: CatalogViewComponent },
{ path: '**', redirectTo: 'login' }
], { useHash: true })
],
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question