Z
Z
zlodiak2018-08-17 15:20:25
JavaScript
zlodiak, 2018-08-17 15:20:25

How to use old routing in angular6?

I am using angular6 and its routing. Thus, if I copy a link and open it, for example, in chrome's anonymous mode, I get a message that the page was not found. I would like to avoid this.
Is it possible to make the main address always start with a hash mark? For example like this:

http://localhost:4200/#/index1
http://localhost:4200/#/index2
http://localhost:4200/#/index3

But when copying the address and pasting it into another window, some one page would open by default. For example:
http://localhost:4200/#/index1
Live demo here

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Luzanov, 2018-08-17
@zlodiak

1. Hash usage: 2. Redirect:

const appRoutes: Routes = [{
    path: '',
    redirectTo: '/index1',
    pathMatch: 'full'
  }
];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question