Angular:
http://angularjs.org/
by mrajcok
HTML
<div ng-controller="MyCtrl">
<input type='text' ng-model='foo' my-dir='customFunction'>
<br>foo={{foo}}
</div>
JavaScript
var app = angular.module('myApp',[]);
app.directive('myDir', function() {
return {
link: function(scope, element, attrs) {
scope.$eval(attrs.myDir);
},
}
});
//app.factory('myService', function() {});
function MyCtrl($scope) {
$scope.customFunction = alert('hi');
$scope.foo = '22';
}