Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 2e5680a

Browse files
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: 3ee744c 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.
1 parent a005797 commit 2e5680a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/content/guide/dev_guide.services.$location.ngdoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,17 +447,19 @@ In this examples we use `<base href="/base/index.html" />`
447447

448448
function initEnv(name) {
449449
var root = angular.element(document.getElementById(name + '-mode'));
450+
// We must kill a link to the injector for this element otherwise angular will
451+
// complain that it has been bootstrapped already.
452+
root.data('$injector', null);
450453
angular.bootstrap(root, [function($compileProvider, $locationProvider, $provide){
451454
$locationProvider.html5Mode(true).hashPrefix('!');
452455

453456
$provide.value('$browser', browsers[name]);
454-
$provide.value('$document', root);
455457
$provide.value('$sniffer', {history: name == 'html5'});
456458

457459
$compileProvider.directive('ngAddressBar', function() {
458460
return function(scope, elm, attrs) {
459461
var browser = browsers[attrs.browser],
460-
input = angular.element('<input type="text">').val(browser.url()),
462+
input = angular.element('<input type="text" style="width: 400px">').val(browser.url()),
461463
delay;
462464

463465
input.on('keypress keyup keydown', function() {

0 commit comments

Comments
 (0)