Q:

Ember Routing - Dynamic Segment - Passing model through 

I am using Ember 3.18 and i have issue with dynamic segment. Here is my router.js
Router.map(function() {

    this.route('posts');

    this.route('post' , {path:"/post/:post_id"});

});

When I try to perform a transition from posts route (which contains all the posts) to post/:post_id (which displays the details of the particular post) using the following 
<div>
{{#each this.data as |data|}}

   <LinkTo @route="dashboard.inbox-mail" @model={{data.id}}>

    <div class="card">
      <div>
        <p class="name">{{data.name}}</p>
      </div>
      <div>
        <p class="title">{{data.title}}</p>
        <p class="date">{{data.timestamp}}</p>
      </div>
    </div>

  </LinkTo>

 {{/each}}
</div>

it does not performs the transition to the post/:post_id. The data contains following attributes 
id - string
name - string
title - string
message - string
timestamp - string
my goal is to pass the post id to post/:post_id and make a API call in the model hook of post/:post_id.
I was able to perform transition using the below code but the downside is that the beforemodel and model hook are not called. Passing the entire data as model results in not calling the model and beforemodel 
<div>
{{#each this.data as |data|}}
   <LinkTo @route="dashboard.inbox-mail" @model={{data}}>
    <div class="card">
      <div>
        <p class="name">{{data.name}}</p>
      </div>
      <div>
        <p class="title">{{data.title}}</p>
        <p class="date">{{data.timestamp}}</p>
      </div>
    </div>
  </LinkTo>
  {{/each}}
</div>

A:

change this.data to 
{{#each @model as |data|}} 

Here is a good example similar to yours:
https://emberigniter.com/getting-started-ember-octane-tutorial/

