diff options
| author | Vojta Jina | 2012-02-29 14:55:38 -0800 | 
|---|---|---|
| committer | Vojta Jina | 2012-03-05 19:09:43 -0800 | 
| commit | 1084ccf7ef8d087e77f2d7197222ab7904fd3fb7 (patch) | |
| tree | 5d4ceb53e2bc8c79d1ecb851ef1aa371a59ab8bd | |
| parent | c2989f6cc6ea8be34101b9ab9bc25d14a2468e20 (diff) | |
| download | angular.js-1084ccf7ef8d087e77f2d7197222ab7904fd3fb7.tar.bz2 | |
fix(docs): Add $locationProvider methods to the docs example provider
- $locationProvider.html5Mode
- $locationProvider.hashPrefix
Docs example is basically a different application on the same page, but we don't want to instantiate multiple instances of $browser or $location service, so we are overriding these providers to return the instances from parent app.
Overriding the service with $provide.value caused a provider to be auto-generated without the necessary hashPrefix and html5Mode apis.
| -rw-r--r-- | docs/src/templates/doc_widgets.js | 7 | 
1 files changed, 6 insertions, 1 deletions
| diff --git a/docs/src/templates/doc_widgets.js b/docs/src/templates/doc_widgets.js index 894f1f24..5d4f8905 100644 --- a/docs/src/templates/doc_widgets.js +++ b/docs/src/templates/doc_widgets.js @@ -85,7 +85,12 @@ angular.module('ngdocs.directives', [], function($compileProvider) {            var modules = [              function($provide) {                $provide.value('$browser', $browser); -              $provide.value('$location', $location); +              $provide.service('$location', function() { +                this.$get = function() { +                  return $location; +                }; +                this.hashPrefix = this.html5Mode = angular.noop; +              });                $provide.decorator('$defer', function($rootScope, $delegate) {                  return angular.extend(function(fn, delay) {                    if (delay && delay > 500) { | 
