Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Routing in app with firebase doesn`t work correct

https://github.com/Wilkuuu/Biblio

In Books component in html i`ve :

<a 
  routerLink="/books/{{book.id}}" 
  class="btn btn-secondary btn-sm">
  <i class="fa fa-file"></i>
</a>

in app-routing :

{ path: 'book/:id', component: BookDetailComponent }

In URL i see an id from firebase, but the path provides me to :

{ path: '**' , component: NotfoundComponent },
like image 243
Arek Szumacher Avatar asked Oct 17 '22 10:10

Arek Szumacher


1 Answers

Just have a look at your route config:

{ path: 'book/:id', component: BookDetailComponent }

The route that you should be using is book/ and not books/

routerLink="/books/{{book.id}}"

should be

routerLink="/book/{{book.id}}"

And yeah, as mentioned by Andrei, the catch-all route(the one with path: '**') should be the last route in your route config.

like image 166
SiddAjmera Avatar answered Oct 20 '22 07:10

SiddAjmera