JSFiddle - React, Tailwind, and code Playground
by ikaruss
HTML
<div ng-app="myApp">
<test ng-controller="ctrl" />
</div>
JavaScript
/* AngularJS directive */
app = angular.module('myApp', []);
app.controller('ctrl', function($scope){
$scope.click = function(){
console.log('clicked'); // see console
};
});
app.directive('test', function(){
return {
//priority: 0,
template: '<span><div ng-click="click()">jajaja (click me)</div><div>nenene</div></span>',
//templateUrl: 'directive.html',
replace: true,
//transclude: false,
restrict: 'E',
//scope: false,
/*
controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
compile: function compile(tElement, tAttrs, transclude) {
return {
pre: function preLink(scope, iElement, iAttrs, controller) { ... },
post: function postLink(scope, iElement, iAttrs, controller) { ... }
}
},
link: function (scope, iElement, iAttrs) {
}
*/
};
});