From 40a9b49800f2434f16fcb935af38d43a4e915bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Rodri=CC=81guez?= Date: Mon, 22 Aug 2016 12:36:55 +0200 Subject: [PATCH] chore: fix live-example for multiple plunkers closes #2167 --- public/resources/js/directives/live-example.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/resources/js/directives/live-example.js b/public/resources/js/directives/live-example.js index 91f8321d64..1946d02f43 100644 --- a/public/resources/js/directives/live-example.js +++ b/public/resources/js/directives/live-example.js @@ -32,15 +32,19 @@ angularIO.directive('liveExample', ['$location', function ($location) { compile: function (tElement, attrs) { var text = tElement.text() || 'live example'; var ex = attrs.name || NgIoUtil.getExampleName($location); - var plnkr = attrs.plnkr || ''; + var plnkr = ''; var href, template; + if (attrs.plnkr) { + plnkr = attrs.plnkr + '.'; + } + var isForDart = attrs.lang === 'dart' || NgIoUtil.isDoc($location, 'dart'); var isForJs = attrs.lang === 'js' || NgIoUtil.isDoc($location, 'js'); var exLang = isForDart ? 'dart' : isForJs ? 'js' : 'ts'; var href = isForDart ? 'http://angular-examples.github.io/' + ex - : '/resources/live-examples/' + ex + '/' + exLang + '/plnkr.html'; + : '/resources/live-examples/' + ex + '/' + exLang + '/' + plnkr + 'plnkr.html'; // Link to live example. var template = a(text, { href: href, target: '_blank' });