JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-controller="BodyController as ctrl" ng-app="app">
<h1 custom text="Hello Plunker!" click="ctrl.click(message)"></h1>
</div>
JavaScript
angular.module('app', []).directive('custom', function () {
return {
restrict: 'A',
scope: {
text: '@',
click: '&click'
},
link: function (scope, element) {
console.log(scope.click);
//...
scope.click({message: "Hello Plunker:"});
//...
}
}
});
angular.module('app').controller('BodyController', function ($scope) {
this.click = function (message) {
alert(message);
}
})