Chapter 1: Working through the directive spectrum - The Attribute Directive

HTML

<script src="https://code.angularjs.org/1.3.2/angular.min.js"></script>
<div ng-app="myApp">
    <div ad2 attribute-directive>     
    </div>
</div>

JavaScript

angular.module('myApp', [])
.directive('attributeDirective',function ($log) {
    return {
        // restrict defaults to A
        restrict: 'A', 
        template: '<p>Something else</p>',
        controller: function() {
        	this.a = 1;
        },
        link: function(scope, el, attrs, ctrls) {
            $log.log(el.html());
            // <p>An attribute directive</p>
            $log.log(attrs.attributeDirective);
            // aval
            $log.log(attrs.someAttr);
            // myvalue
        }
    };
})
.directive('ad2',function ($log) {
    return {
        // restrict defaults to A
        restrict: 'A', 
         controller: function() {
        	this.a = 2;
        },
        link: function(scope, el, attrs, ctrls) {
        	$log.log(ctrls)
            
        }
    };
});