parent
fc2815ff6d
commit
40a9b49800
@ -32,15 +32,19 @@ angularIO.directive('liveExample', ['$location', function ($location) {
|
|||||||
compile: function (tElement, attrs) {
|
compile: function (tElement, attrs) {
|
||||||
var text = tElement.text() || 'live example';
|
var text = tElement.text() || 'live example';
|
||||||
var ex = attrs.name || NgIoUtil.getExampleName($location);
|
var ex = attrs.name || NgIoUtil.getExampleName($location);
|
||||||
var plnkr = attrs.plnkr || '';
|
var plnkr = '';
|
||||||
var href, template;
|
var href, template;
|
||||||
|
|
||||||
|
if (attrs.plnkr) {
|
||||||
|
plnkr = attrs.plnkr + '.';
|
||||||
|
}
|
||||||
|
|
||||||
var isForDart = attrs.lang === 'dart' || NgIoUtil.isDoc($location, 'dart');
|
var isForDart = attrs.lang === 'dart' || NgIoUtil.isDoc($location, 'dart');
|
||||||
var isForJs = attrs.lang === 'js' || NgIoUtil.isDoc($location, 'js');
|
var isForJs = attrs.lang === 'js' || NgIoUtil.isDoc($location, 'js');
|
||||||
var exLang = isForDart ? 'dart' : isForJs ? 'js' : 'ts';
|
var exLang = isForDart ? 'dart' : isForJs ? 'js' : 'ts';
|
||||||
var href = isForDart
|
var href = isForDart
|
||||||
? 'http://angular-examples.github.io/' + ex
|
? '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.
|
// Link to live example.
|
||||||
var template = a(text, { href: href, target: '_blank' });
|
var template = a(text, { href: href, target: '_blank' });
|
||||||
|
Loading…
x
Reference in New Issue
Block a user