Reputation: 219
I have a variable in my controller called appName
that i am calling from URL. The format for URL is /:appName/configure
. I am using {{#link-to}}
tag to redirect in the nav.
My question is now do i pass the appName
inside link-to
. The current code that i have is
{{#link-to 'dashboard' 'testApp' tagName="li" class="uk-active"}}<a nohref>Dashboard</a>{{/link-to}}
Here i should be able to change the testApp
with the variable in from controller. Also if i am doing this wrong would appreciate the correct way to do the same.
Upvotes: 0
Views: 215
Reputation: 12872
Yes. You can include controller properties in link-to helper.
{{#link-to 'dashboard' appName tagName="li" class="uk-active"}}<a nohref>Dashboard</a>{{/link-to}}
You should include dynamic segment property name in router.js
this.route('dashboard',{path:'/dashboard/:appName/configure'});
You can modify the path as your required pattern.
Refer ember guide for dynamic segments: https://guides.emberjs.com/v2.3.0/routing/defining-your-routes/#toc_dynamic-segments
Upvotes: 1