lundi 2 février 2015

ember nested route needs selected object on parent route using ember.select

i have ember routes set up as a list and single object -- and use a Ember.Select for the list



this.resource('posts', { path: 'posts' }, function() { // the collection
this.resource('brand', { path: 'post/:post_id' }, function() { //the selected object


all functions as expected if a user navigates under the normal procedure from ground zero. 1. viewing the collection, #/posts/ 2. then selecting the post using the select component #/posts/post/001


however, when accessing the subview directly (aka via refresh reload browser url) then the selected object is not set on the parent route. ie. the selected post in the ember.select is not highlighted. #/posts/post/001


is there a method of accessing the parent route (or controller) and then setting a selected object.


i had thought of having an option for selected id on the initial collection ...



this.resource('posts', { path: 'posts/:selected_postid' }, function() { // the collection
this.resource('posts', { path: 'post/:post_id' }, function() { //the selected object


then the url will be...


#/posts/001/post/001


the problem here is transitionTo makes no sense on itself. is it possible to set a full {{posts:selected_postid/post/:post_id}} url... versus just the sub clip. and re-rendering the parent unnecessarily.


Aucun commentaire:

Enregistrer un commentaire