From d0202424c39c6d748dde8bc0995712758e9be0af Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Wed, 20 Nov 2013 10:35:27 +0000 Subject: [PATCH] fix(loader): expose `$$minErr` to modules such as`ngResource` 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. --- src/loader.js | 9 ++++++++- test/loaderSpec.js | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/loader.js b/src/loader.js index b8d509175fc9..3c56c12da319 100644 --- a/src/loader.js +++ b/src/loader.js @@ -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.} */ var modules = {}; @@ -299,5 +306,5 @@ function setupModuleLoader(window) { }); }; }); - +}); } diff --git a/test/loaderSpec.js b/test/loaderSpec.js index 2a564115be7c..816e0a10603c 100644 --- a/test/loaderSpec.js +++ b/test/loaderSpec.js @@ -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)); + }) });