From 6ce2d2a867215be1d0f1f062da30f0a436d9590f 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. Closes #5050 --- src/loader.js | 5 ++++- test/loaderSpec.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/loader.js b/src/loader.js index b8d509175fc9..0368bb614ecc 100644 --- a/src/loader.js +++ b/src/loader.js @@ -17,7 +17,10 @@ function setupModuleLoader(window) { return obj[name] || (obj[name] = factory()); } - return ensure(ensure(window, 'angular', Object), 'module', function() { + var angular = ensure(window, 'angular', Object); + angular.$$minErr = angular.$$minErr || minErr; + + return ensure(angular, 'module', function() { /** @type {Object.} */ var modules = {}; 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)); + }) });