jeudi 24 février 2022

Dynamic model in LinkTo component in Ember

I am using Ember 3.18, I am facing the below issue. Consider the following routes:

Router.map(function() {
  this.route('author');
  this.route('author' , {path:"/author/:author_id"});
});

Now, in my hbs file, I am trying to transition to the above routes using a single LinkTo. As you can see, only the second route requires model attribute. In simple terms, I want to combine the below 2 into a single line.

<LinkTo @route="author" />
<LinkTo @route="author" @model="2" />

As you can see, I require the model attribute to be gone in certain cases and availble in certain cases.

Please help.




Aucun commentaire:

Enregistrer un commentaire