JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.angularjs.org/angular-1.0.0rc8.js"></script>
<div ng-controller="MyController">
<h1>{{test}}</h1>
<hr />
<input type="text" my-directive="test" />
</div>
JavaScript
var myApp = angular.module('myApp',[]);
myApp.directive('myDirective', function () {
var linker = function (scope, element, attrs) {
attrs.$set('ng-model', attrs.myDirective);
attrs.$set('ng-class', '{\'class\' : testFunction()}');
}
return {
restrict: 'A',
link: linker
}
});
function MyController($scope) {
$scope.test = 'test';
$scope.testFunction = function () {
return true;
};
}