This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Add isStrictDi to $injector #11728
Closed
Description
I'm writing a utility library where I have a use case to know when strict DI is enabled on a given $injector
. I could really use some reasonable way of knowing without having to do something crazy like:
function isStrictDi($injector) {
try {
$injector.invoke(function(a) {});
return false;
} catch(e) {
return true;
}
}
I'm thinking that we could just add a line that says instanceInjector.strictDi = strictDi
right here before the instanceInjector
is returned.
I would happily open a PR with tests which would do this. Just want to make sure this is the correct approach.