Skip to content

Commit 1368c18

Browse files
fix(resolve): Detect and honor strictDi in angularjs versions 1.3 and 1.4
Closes #3678
1 parent cd426e5 commit 1368c18

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/services.ts

+9
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ function runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRoute
118118
services.$injector = $injector;
119119
services.$q = <any>$q;
120120

121+
// https://github.com/angular-ui/ui-router/issues/3678
122+
if (!$injector.hasOwnProperty('strictDi')) {
123+
try {
124+
$injector.invoke(function(checkStrictDi) {});
125+
} catch (error) {
126+
$injector.strictDi = !!/strict mode/.exec(error && error.toString());
127+
}
128+
}
129+
121130
// The $injector is now available.
122131
// Find any resolvables that had dependency annotation deferred
123132
$uiRouter.stateRegistry

0 commit comments

Comments
 (0)