Routing issue : inconsistent behaviour between app and pages
- Lingua principale
- TypeScript
- Stelle
- 25.7k
- Fork
- 7.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
### Issue type
**I'm submitting a ...** (check one with "x")
* [X] bug report
* [ ] feature request
* [ ] question about the decisions made in the repository
### Issue description
**Current behavior:**
When trying to set some path to `NotFoundComponent` directly through `app-routing.module.ts`, it causes an infinite loading when trying to access this path. The same code works if put inside a submodule path (for example, `pages`, in `pages-routing.module.ts`). Absolutely no error is displaying in the console or anywhere.
**Expected behavior:**
Handle the request correctly and send the user to the `NotFoundComponent`. If something is wrong, display an error (for others errors in routing modules, we get errors displayed in the console)
**Steps to reproduce:**
See the **Related code** below. Basically, we put on [app-routing L48](https://github.com/akveo/ngx-admin/blob/master/src/app/app-routing.module.ts#L48) the code that is used on [pages-routing L78](https://github.com/akveo/ngx-admin/blob/master/src/app/pages/pages-routing.module.ts#L78).
**Related code:**
`app-routing.module.ts` **NOT WORKING**
```js
[...]
{ path: '', redirectTo: 'pages', pathMatch: 'full' },
//{ path: '**', redirectTo: 'pages' }, // starter code : redirect all requests to pages
{ path: '**', component: NotFoundComponent, }, // new code : (try to) handle requests here
];
```
`pages-routing.module.ts` **WORKING WELL**
```js
[...]
{
path: '',
redirectTo: 'dashboard',
pathMatch: 'full',
},
{
path: '**',
component: NotFoundComponent,
},
],
}];
```
### Other information:
**npm, node, OS, Browser**
```
NPM: 6.14.16
Node: v14.19.1
Server (dev) running on Linux (WSL), client on Windows 10
Browser: Chrome
```
**Angular, Nebular**
```
Nebular: 8.0.0
Angular: 12.2.16
```
Any help to understand the issue will be appreciated 😄 I plan to use `ngx-admin` a lot and contribute, so I'm down to fix this, but I'm a bit stuck here 😅
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.