Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 79577c5

Browse files
Kent C. Doddslgalfaso
Kent C. Dodds
authored andcommitted
feat($injector): add strictDi property to $injector instance
Add a strictDi property which is true or false when creating an instance of an injector. Closes #11728 Closes #11734
1 parent b71d7c3 commit 79577c5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/auto/injector.js

+2
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ function createInjector(modulesToLoad, strictDi) {
647647

648648
forEach(loadModules(modulesToLoad), function(fn) { if (fn) instanceInjector.invoke(fn); });
649649

650+
instanceInjector.strictDi = strictDi;
651+
650652
return instanceInjector;
651653

652654
////////////////////////////////////

test/auto/injectorSpec.js

+8
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ describe('injector', function() {
122122
expect($injector).not.toBe(providerInjector);
123123
}));
124124

125+
it('should have an false strictDi property', inject(function($injector) {
126+
expect($injector.strictDi).toBe(false);
127+
}));
128+
125129

126130
describe('invoke', function() {
127131
var args;
@@ -1053,4 +1057,8 @@ describe('strict-di injector', function() {
10531057
inject(function($test) {});
10541058
expect(called).toBe(true);
10551059
});
1060+
1061+
it('should set strictDi property to true on the injector instance', inject(function($injector) {
1062+
expect($injector.strictDi).toBe(true);
1063+
}));
10561064
});

0 commit comments

Comments
 (0)