JSFiddle - React, Tailwind, and code Playground
by AlexFigueiredoo
HTML
<script src="http://code.angularjs.org/1.2.3/angular.js"></script>
<div ng-app="TestApp">
<div my-directive></div>
</div>
JavaScript
var app = angular.module("TestApp", []);
app.directive("myDirective", function($compile) {
return {
replace: true,
scope: {},
template: "<div></div>",
link: function(scope, elem) {
scope.list = [1, 2, 3, 4, 5];
$compile("<div my-list></div>")(scope, function(clone) {
alert(clone[0].outerHTML);
elem.html(clone);
});
}
};
});
app.directive("myList", function() {
return {
replace: true,
template: "<ul><li ng-repeat=\"item in list\">{{item}}</li></ul>"
};
});