JSFiddle - React, Tailwind, and code Playground
by yoorek
HTML
<div class="container" ng-app="app" ng-controller="AppController">
<sandbox title="Attribute Title"></sandbox>
</div>
JavaScript
var app = angular.module('app', [], function () {});
app.controller('AppController', function ($scope) {
$scope.title = "AppController Title";
});
app.directive('sandbox', function ($log, $compile) {
return {
restrict: 'E',
scope: {
title: "@"
},
controller: function ($scope, $element, $attrs) {
$scope.title = "Directive Controller title";
},
template: '<h1>Template</h1>', // change it to: '' and Run, than change Angular to 1.1.x
compile: function (tElement, tAttrs) {
tElement.append('<h2> Title = {{ title }}</h2>');
}
}
});