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

Commit 1084ccf

Browse files
committed
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.
1 parent c2989f6 commit 1084ccf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/src/templates/doc_widgets.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,12 @@ angular.module('ngdocs.directives', [], function($compileProvider) {
8585
var modules = [
8686
function($provide) {
8787
$provide.value('$browser', $browser);
88-
$provide.value('$location', $location);
88+
$provide.service('$location', function() {
89+
this.$get = function() {
90+
return $location;
91+
};
92+
this.hashPrefix = this.html5Mode = angular.noop;
93+
});
8994
$provide.decorator('$defer', function($rootScope, $delegate) {
9095
return angular.extend(function(fn, delay) {
9196
if (delay && delay > 500) {

0 commit comments

Comments
 (0)