0

This one has me baffled. I am still new to ember but I had some nested routes where I was calling transitionTo with the redirect hook on the parent route to pull in a nested child route.

App.CategoryRoute = Ember.Route.extend({
   redirect: { transitionTo('subcategories'); }
});

I since removed the redirect hook and the transitionTo however the transition is still occurring. I even have closed my project and reopened, cleared the cache on all browsers but it still is holding onto the transition. I have also tried calling a bogus route under the redirect and it errors out. As soon as I remove, it goes back to this behavior and transitions into the child route. Has anyone ever had this happen? What am I doing wrong? Please let me know if you need more code.

Here is the rest of the code. in my troubleshooting i have removed and added so much stuff I will try to get it back to what it was when it started happening. I also removed as much 'fluff' as I could from the handlbars code sections to make it clearer.

App = Ember.Application.create({
   rootElement: "#app",
   LOG_TRANSITIONS: true

 });
 App.Router.map(function () {
    this.resource("category", function () {
       this.resource('subcategories', { path: "/" }, function () {
            //subcategory route show list of items in that subcategory
            this.resource('subcategory', { path: "/:subcategoryslug" }, function () {
               //this is individual item
               this.route("item", { path: "/:itemid" });
             });
        });
     });
  });
App.CategoryRoute = Ember.Route.extend({
   redirect: { transitionTo('subcategories'); }
});
App.CategorySubcategoriesRoute = Ember.Route.extend({
      model: function (params) {
            Ember.Logger.warn("Inside category route");
            categoryid = 47
            //this calls extended object for json data 
            //works just fine when routes are rendered. 
            return App.Subcategory.findAll(categoryid); 
      }
});

Here is the handlebars blocks:

<script type="text/x-handlebars" data-template-name="index">

    <h2>APPLICATION TITLE</h2>       

    <div>
    <strong>{{#link-to 'category'}}CategoryName{{/link-to}}</strong>            
    </div>        
</script>
<script type="text/x-handlebars" data-template-name="category/index">
    <h2>Category Name</h2> 
    <div>
    {{outlet "subcategories"}}       
    </div>
</script>

<script type="text/x-handlebars" data-template-name="category/subcategories">
 {{#each subcategory in model}}
    <div>
     <strong>{{#link-to 'category.subcategory.index' subcategory}}{{subcategory.subcategoryname}}{{/link-to}}</strong><br>
     {{subcategory.description}}
    </div>
    {{/each}}
</script>
EHeine
  • 385
  • 1
  • 3
  • 13
  • Can you please show the rest of your code? – Oren Hizkiya Jan 06 '15 at 14:50
  • 2
    Oh gee whiz. I got it. My routing map was the problem. Having the subcategories path specified as the same as the category route apparently causes issues. I was trying to get them to render inside the the other route but that a little redundant. So this is fixed. Sorry! – EHeine Jan 06 '15 at 15:34

0 Answers0