Angular: Directives
http://angularjs.org/
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-app="HelloApp">
<hello-world name="John Lindquist"></hello-world>
</div>
JavaScript
angular.module('components', [])
.directive('helloWorld', function () {
return {
restrict: 'E',
scope: {
name: 'bind'
},
template: '<span>Hello {{name}}</span>'
};
});
angular.module('HelloApp', ['components']);