From 31e0101020d14e976f121dfac12aad9b1924da17 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Wed, 16 Nov 2016 17:51:06 +0000 Subject: [PATCH] fix(live-example): correctly match example name (#2815) Currently, when visiting a page with a relative link e.g. https://angular.io/docs/ts/latest/guide/testing.html#!#top, `NgIoUtil.getExampleName` fails to match the example name. This results on `live-example` directives on that page missing the example name in the link: instead of linking to https://angular.io/resources/live-examples/testing/ts/plnkr.html it will link to https://angular.io/resources/live-examples//ts/plnkr.html (notice the missing `testing` and the double slashes). --- public/resources/js/util.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/resources/js/util.js b/public/resources/js/util.js index 91cf6e5a01..89253de090 100644 --- a/public/resources/js/util.js +++ b/public/resources/js/util.js @@ -77,7 +77,7 @@ var NgIoUtil = (function () { // TODO: use $location.path() instead(?). It seems to be empty. var loc = $location.absUrl(); // E.g., https://example.com/docs/dart/latest/guide/displaying-data.html - var matches = loc.match(/.*\/([\w\-]+)(\.html)?$/); + var matches = loc.match(/.*\/([\w\-]+)(\.html)?/); if (matches) NgIoUtil.setExampleName(matches[1]); // cache name } return NgIoUtil._exampleName;