From 2e5680a4e3178803c02ac56e1f0388766b32466c Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Thu, 3 Oct 2013 23:05:56 +0100 Subject: docs(guide/$location): fix broken example demo The demo of the hash-bang vs html5-mode deep links was broken since the introduction of a check for previously bootstrapped elements. See this commit: 3ee744cc63 We fix this problem by applying a null for the injector value of the element of the at the root of the sub-app. It also turns out that it was not necessary, and if fact broke the demo, to replace the $document service for the sub-app. This was because the $compile service calls `$document.createElement()`, which doesn't exist on a `div`. Finally, the bootstrap CSS was limiting the width of the ngAddress bar input box, which made it difficult to see the changing URLs. --- docs/content/guide/dev_guide.services.$location.ngdoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/content/guide/dev_guide.services.$location.ngdoc b/docs/content/guide/dev_guide.services.$location.ngdoc index 2fb1adb4..bfd1d5d9 100644 --- a/docs/content/guide/dev_guide.services.$location.ngdoc +++ b/docs/content/guide/dev_guide.services.$location.ngdoc @@ -447,17 +447,19 @@ In this examples we use `` function initEnv(name) { var root = angular.element(document.getElementById(name + '-mode')); + // We must kill a link to the injector for this element otherwise angular will + // complain that it has been bootstrapped already. + root.data('$injector', null); angular.bootstrap(root, [function($compileProvider, $locationProvider, $provide){ $locationProvider.html5Mode(true).hashPrefix('!'); $provide.value('$browser', browsers[name]); - $provide.value('$document', root); $provide.value('$sniffer', {history: name == 'html5'}); $compileProvider.directive('ngAddressBar', function() { return function(scope, elm, attrs) { var browser = browsers[attrs.browser], - input = angular.element('').val(browser.url()), + input = angular.element('').val(browser.url()), delay; input.on('keypress keyup keydown', function() { -- cgit v1.2.3