Given the following, $injector.get
will fail as $rootScope
is not available.
app.factory('$exceptionHandler', ['$injector', $injector => {
const $rootScope = $injector.get('$rootScope')
return (exception, cause) => {
// code
}
})
In researching, I keep coming across this, which works as it's resolved at runtime (when the inner function is called).
app.factory('$exceptionHandler', ['$injector', $injector => {
return (exception, cause) => {
const $rootScope = $injector.get('$rootScope')
// code
}
})
What I'd like is to somehow know when I can resolve the dependency. Something like:
app.factory('$exceptionHandler', ['$injector', $injector => {
$injector.illLetYouKnowWhenWeCanDoStuff().then(() => {
const $rootScope = $injector.get('$rootScope')
})
return (exception, cause) => {
// code
}
})
Is this possible?
related => $location from $exceptionHandler - dependency conflict