JSFiddle - React, Tailwind, and code Playground
by Michele Marcucci
February 20, 2016
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-route.js"></script>
<div ng-app="app" ng-controller="dummy">
<directive refresh="vm.refresh || vm.refresh(search)"></directive>
</div>
CSS
li a {
background-color: red !important;
border: 1px solid red !important;
}
li a:before {
border-left-color: red !important;
}
.green {
background-color: green !important;
}
JavaScript
var app = angular.module("app", []);
app.controller('dummy', function ($scope) {
$scope.vm = {};
$scope.vm.refresh = function () {
console.log('WORLD');
}
})
app.directive('directive', function() {
return {
restrict: "E",
scope: {
refresh: "="
},
template: '<div></div>',
link: function(scope, element, attrs) {
console.log(scope.refresh);
}
};
});