JSFiddle - React, Tailwind, and code Playground

by SM ADnan

HTML

<div ng-app="app" ng-controller="TestController">
    <dir1></dir1>
    <dir2></dir2>
</div>

JavaScript

var app = angular.module('app', []);
app.controller('TestController', ['$scope', function($scope){}]);

app.directive('dir1', function(){
    return {
        restrict: 'EA',
        template: '<div>Sample text of dir1</div>',
        scope: {},
        link: ControllerOfDir1Dir2
    };
});

app.directive('dir2', function(){
    return {
        restrict: 'EA',
        template: '<div>Sample text of dir2</div>',
        scope: {},
        link: ControllerOfDir1Dir2
    };
});

function ControllerOfDir1Dir2(scope, element, attr){
    console.log([scope, element, attr]);
    console.log(element[0].nodeName);
    var existingHtml = element.html();
    element.find('div').html(existingHtml + " And some added text");
}