From bbd14ce02b49a7c9d9fbc095e9d9f26700264c5a Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Wed, 20 Aug 2014 16:23:13 -0700 Subject: [PATCH] fix(minErr): encode btstrpd error input to strip angle brackets The $sanitize service was returning an empty string to the error page because the input was usually a single html tag (sometimes it could be `document`). This fix replaces angle brackets with html entities. Closes #8683 --- src/Angular.js | 6 +++++- test/AngularSpec.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 678c6fe12484..f29a5c5ec504 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1395,7 +1395,11 @@ function bootstrap(element, modules, config) { if (element.injector()) { var tag = (element[0] === document) ? 'document' : startingTag(element); - throw ngMinErr('btstrpd', "App Already Bootstrapped with this Element '{0}'", tag); + //Encode angle brackets to prevent input from being sanitized to empty string #8683 + throw ngMinErr( + 'btstrpd', + "App Already Bootstrapped with this Element '{0}'", + tag.replace(//,'>')); } modules = modules || []; diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 878eb9567d63..0b9ae8411658 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -786,7 +786,7 @@ describe('angular', function() { expect(function () { angular.bootstrap(element); }).toThrowMatching( - /\[ng:btstrpd\] App Already Bootstrapped with this Element '
'/i + /\[ng:btstrpd\] App Already Bootstrapped with this Element '<div class="?ng\-scope"?( ng[0-9]+="?[0-9]+"?)?>'/i ); dealoc(element);