Skip to content

Instantly share code, notes, and snippets.

@istro
Created May 8, 2014 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save istro/2c540e0469d5f55ed2cf to your computer and use it in GitHub Desktop.
Save istro/2c540e0469d5f55ed2cf to your computer and use it in GitHub Desktop.
ember dev helpers question
// app/helpers/dev.js
Object.defineProperty(window, 'ac', {
get: function () {
return window.container.lookup('controller:application');
}
});
// CurrentRoute - NOT WORKING (WHYYYYY?)
Object.defineProperty(window, 'currentRouteNotWorking', {
get: function () {
return window.container.lookup('route:'+window.container.lookup('controller.application').currentRouteName);
}
});
// this works, but jshint complains about 'ac' not being defined
Object.defineProperty(window, 'currentRoute', {
get: function () {
return window.container.lookup('route:'+ac.currentRouteName);
}
});
// currentModel - not working (wtf?)
Object.defineProperty(window, 'currentModelNotWorking', {
return currentRoute.get('currentModel');
});
// and this one does work
Object.defineProperty(window, 'currentModel', {
get: function () {
return window.container.lookup('route:'+ac.currentRouteName).get('currentModel');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment