Angular directives part II , decorating directives

Attribute Directives So far I have been talking about element directives and the three different modes through which you can pass data. Attribute directives is built on the same principles of course but their application is different. Attribute directives are decorator directives and therefore we will look at situations where ‘elements’ or even other ‘element … More Angular directives part II , decorating directives

Angular directives

Directives First directive Declaration angular.module(‘app’).directive(‘testDir’,function(){ return { restrict : ‘E’, replace : true, transclude : true, template : ‘<h1>test</h1>’ } }) Usage <test-dir></test-dir> Casing matters: testDir becomes test-dir in view Restrict What can it be applied to: Comments Elements, E Attributes, A CSS Replace Determines wether the custom element is being replaced with view content … More Angular directives