How can i refresh my page on angular when i pass an id?

i have a detail page on Angular, that if i go to url../post/id do a call to server and findbyid and works, on angular i call it with a button [routerLink]=”[‘/postDetail/’+ posts[6].id]”

and he goes to compoment that call api on /post/post-detail/id.

 <button [routerLink]="['/postDetail/'+ posts[0].id]"  class="btn btn-primary">Read More &rarr;</button>
 relativePathById = "post/post-detail/";
 findPostById(id:number) {
      return this.http.get<any>(environment.endpoint + this.relativePathById+id);
    }

All this process works but when i refresh pages i have a 404 error.

i tried several times, like some intervent to lifecycle process but nothing worked

How can i do to solve it?

Source: New feed
Source Url How can i refresh my page on angular when i pass an id?