javascript - Pass on the current routes active ID to a component -
i have done several things components , absolutely awesome, i've ran little problem cant seem solve, , google returns vague answers, pretty new.
i want pass in id of current active controller/model has been selected.
as component isolated rest of application, standard ways of using controllerfor
doesn't seem work.
i can pass in integers component using applicationcontroller
, can't seem find way pass in current id. have made ugly workaround parses current url , splits /
, thats not ember way. how should approach this?
please see if fiddle addresses concerns. correct approach believe creating binding component.
http://jsfiddle.net/ahaurw01/cb2ws/1/
the essence of approach having component looks this:
<script type="text/x-handlebars" data-template-name="components/my-comp"> id {{id}}. </script>
and using in manner:
<script type="text/x-handlebars" data-template-name="thing"> {{my-comp id=model.id}} </script>
the model
property present on every objectcontroller
, can bind id of model.
Comments
Post a Comment