JSFiddle - React, Tailwind, and code Playground
by lucas frecia
HTML
<section ng-app="myApp" ng-controller="MainCtrl">
<adddiv></adddiv>
<div id="space-for-buttons"></div>
</section>
JavaScript
var myApp = angular.module('myApp', []);
function MainCtrl($scope) {
}
//Directive for adding divs
myApp.directive("adddivs", function($compile){
return function(scope, element){
element.bind("click", function(){
angular.element(document.getElementById('space-for-buttons')).append($compile("<div >hnh</div>")(scope));
});
};
});
//Directive that returns an element which adds divs
myApp.directive("adddiv", function(){
return {
restrict: "E",
template: "<button adddivs>Click to add div</button>"
}
});