Created
May 8, 2014 20:09
-
-
Save istro/2c540e0469d5f55ed2cf to your computer and use it in GitHub Desktop.
ember dev helpers question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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