From 1084ccf7ef8d087e77f2d7197222ab7904fd3fb7 Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Wed, 29 Feb 2012 14:55:38 -0800 Subject: 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.--- docs/src/templates/doc_widgets.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'docs/src') 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) { -- cgit v1.2.3