Simple Directive Example
HTML
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<div ng-app="demo">
<datepicker></datepicker>
</div>
JavaScript
angular.module('demo', [
]).directive('datepicker', function(){
var linker = function(scope,element,attrs) {
$(element).find("input").datepicker();
};
return {
restrict: "E",
link: linker,
template: "<input type=\"text\">"
}
});