AngularJS Example
HTML
<div ng-app="helloHabrahabr">
<span habra-habr="hello" some-attr="Hello Habr!"></span>
</div>
JavaScript
angular.module('helloHabrahabr', [])
.directive('habraHabr', function() {
return {
template:"{{someAttr}}-{{qwerty}}",
scope:{
someAttr:'@someAttr'
},
link: function (scope, element, attrs) {
scope.qwerty = attrs.someAttr;
console.log('qwerty', scope.qwerty);
console.log('someAttr', scope.someAttr);
}
}
});