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

Commit

Permalink
fix(loader): expose $$minErr to modules such asngResource
Browse files Browse the repository at this point in the history
This is highlighted in angular-phonecat when you try to use the index-async.html
which needs to load the ngResource module asynchronously but fails when it tries
to call `angular.$$minErr` to create the $resourceMinErr object.

Closes #5050
  • Loading branch information
petebacondarwin authored and IgorMinar committed Nov 22, 2013
1 parent e6521e7 commit 9e89a31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ function setupModuleLoader(window) {
return obj[name] || (obj[name] = factory());
}

return ensure(ensure(window, 'angular', Object), 'module', function() {
var angular = ensure(window, 'angular', Object);

// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
angular.$$minErr = angular.$$minErr || minErr;

return ensure(angular, 'module', function() {
/** @type {Object.<string, angular.Module>} */
var modules = {};

Expand Down
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));
})
});

0 comments on commit 9e89a31

Please sign in to comment.