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>
<LinkTo @route="dashboard.inbox-mail" @model=>
<div class="card">
<div>
<p class="name"></p>
</div>
<div>
<p class="title"></p>
<p class="date"></p>
</div>
</div>
</LinkTo>
</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>
<LinkTo @route="dashboard.inbox-mail" @model=>
<div class="card">
<div>
<p class="name"></p>
</div>
<div>
<p class="title"></p>
<p class="date"></p>
</div>
</div>
</LinkTo>
</div>
Aucun commentaire:
Enregistrer un commentaire