From 9307ccf6ee558ebc05b7c48dc40c41e44ba20e8f Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 22 Jun 2018 21:37:24 +0100 Subject: [PATCH] chore(docs-app): ensure ToC links contain the path Without the path the link is always pointing to the root page, rather than the current page, which means that copying the link address or opening the page in a new tab is broken. Closes #16608 --- docs/app/src/directives.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/app/src/directives.js b/docs/app/src/directives.js index c679a15ac4d1..b1dcd94e3625 100644 --- a/docs/app/src/directives.js +++ b/docs/app/src/directives.js @@ -91,13 +91,16 @@ directivesModule .component('tocTree', { template: '', bindings: { items: '<' - } + }, + controller: ['$location', function($location) { + this.path = $location.path().replace(/^\/?(.+?)(\/index)?\/?$/, '$1'); + }] }) .directive('tocContainer', function() { return {