openmct/example/styleguide/src/MCTExample.js

31 lines
770 B
JavaScript
Raw Normal View History

2017-01-30 21:46:24 +00:00
define([
'text!../res/templates/mct-example.html'
], function (
MCTExampleTemplate
) {
function MCTExample() {
function link($scope, $element, $attrs, controller, $transclude) {
var codeEl = $element.find('pre');
2017-01-30 21:46:24 +00:00
var exampleEl = $element.find('div');
$transclude(function (clone) {
exampleEl.append(clone);
2017-01-30 23:24:25 +00:00
codeEl.text(exampleEl.html()
.replace(/ class="ng-scope"/g, "")
.replace(/ ng-scope"/g, '"'));
2017-01-30 21:46:24 +00:00
});
}
return {
restrict: "E",
template: MCTExampleTemplate,
transclude: true,
link: link,
replace: true
};
}
return MCTExample;
});