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

fix(loader): expose $$minErr to modules such asngResource #5050

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ function setupModuleLoader(window) {
}

return ensure(ensure(window, 'angular', Object), 'module', function() {
// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during
// bootstrap
var angular = ensure(window, 'angular', Object);
angular.$$minErr = angular.$$minErr || minErr;

return ensure(angular, 'module', function() {

/** @type {Object.<string, angular.Module>} */
var modules = {};

Expand Down Expand Up @@ -299,5 +306,5 @@ function setupModuleLoader(window) {
});
};
});

});
}
4 changes: 4 additions & 0 deletions test/loaderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,8 @@ describe('module loader', function() {
window.angular.module('hasOwnProperty', []);
}).toThrowMinErr('ng','badname', "hasOwnProperty is not a valid module name");
});

it('should expose `$$minErr` on the `angular` object', function() {
expect(window.angular.$$minErr).toEqual(jasmine.any(Function));
})
});