I’m sure I’m doing everything incorrect here so your guidance is much appreciated. By the way, I’m using ember-cli with ember-data, and even though I’ve built a few Ember projects I still consider myself pretty novice.
Question #1: It seems like in my ‘categories/category.js’ controller using { needs: [‘application’] } I can trace in Chrome the ‘controllers.application’ object and see a ‘currentPath’ property right there in Chrome dev tools, but then when I trace ‘controllers.application.currentPath’ it returns as ‘undefined’ ??!
I’m trying to get the current page so that I can update a menu dropdown, and so in my ‘category’ controller I’m defining this:
onPageChange:function(){
console.log("Page Change", this.get('controllers.application.currentPath')); // returns 'Page Change undefined'
console.log("Page Change", this.get('controllers.application')); // returns a Class object that has both 'currentPath' and 'currentRouteName' (shows as 'categories.category'
}.observes('currentPath') // why does this only update if I have 'currentPath' observed, and not 'controllers.application.currentPath'??
Question #2: Say I’m able to grab the currentPath, why doesn’t it show the full path with the selected slug? It just shows ‘categories.category’ and not ‘categories.category.my-sub-page’? My routes are:
this.resource('categories', {path:'/'}, function(){
this.route('category', {path: ':category_slug'});
});