diff options
| author | Pete Bacon Darwin | 2013-10-03 23:05:56 +0100 | 
|---|---|---|
| committer | Pete Bacon Darwin | 2013-10-03 23:05:56 +0100 | 
| commit | 2e5680a4e3178803c02ac56e1f0388766b32466c (patch) | |
| tree | 069850bd5d01cefdfd8f60a33a91ce039669c425 /docs/content/guide/dev_guide.services.$location.ngdoc | |
| parent | a005797afa9bdb290d90ee0d3dd394c6551c3321 (diff) | |
| download | angular.js-2e5680a4e3178803c02ac56e1f0388766b32466c.tar.bz2 | |
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.
Diffstat (limited to 'docs/content/guide/dev_guide.services.$location.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.services.$location.ngdoc | 6 | 
1 files 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 `<base href="/base/index.html" />`    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('<input type="text">').val(browser.url()), +              input = angular.element('<input type="text" style="width: 400px">').val(browser.url()),                delay;            input.on('keypress keyup keydown', function() { | 
