Skip to content

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 angular#5050
  • Loading branch information
petebacondarwin authored and jamesdaily committed Jan 27, 2014
1 parent d314eee commit c86ba17
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 c86ba17

Please sign in to comment.