JSFiddle - React, Tailwind, and code Playground

by user645715

HTML

<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
    <div element="apple">Red</div>
    <div element="berry">Blue</div>

JavaScript

var app = angular.module('myApp', []);

app.directive("element", function () {
    return {
        restrict: "A",
        template: '<h1>{{type}}</h1>',
        link: function (scope, element, attrs) {
            scope.type = attrs.element;
            console.log("Setting:  "+scope.type);
        },       
        controller: function ($scope) {
            console.log("Checking: "+$scope.type);
        }
    };
})