javascript - how to pass and receive a parameter using link-to from ember js? -


i have on page list of clients (only names) , when click on each 1 of them, want open new page called 'clientdetails' in details of client besides name (i have address , age) ;

what have far :

{{#each model |client|}}     <p> {{#link-to "clientdetails"}} {{client.name}} {{/link-to}}     </p>   {{/each}} 

how should pass client.address , client.age clientdetails , display them accordingly in clientdetails page?

thank you.

take at:

https://guides.emberjs.com/v2.5.0/templates/links/

i guess create route in route.js route client details:

router.map(function() {   this.route('clients', function(){     this.route('clientdetails', { path: '/:client_id' });   }); }); 

in template (to link client details):

{{#each model |client|}}     <p> {{#link-to "clientdetails" client}} {{client.name}} {{/link-to}}     </p>  {{/each}} 

last, create template clientdetails show client details:

<p>{{model.name}}</p> <p>{{model.address}}</p> <p>{{model.age}}</p> 

hope helps,


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -