I am trying to use directive to create and append several tags to a module.directive(\'createControl\', function(){
re
Read Attributes/observing interpolated attributes section of the directive docs. During the link phase the attributes haven't been set.
There are several ways including using attrs.$observe
or $timeout
.
app.directive('createControl', function($timeout){
return function(scope, element, attrs){
attrs.$observe('createControl',function(){
console.log(' type:',attrs.createControl);
element.text('Directive text, type is: '+attrs.createControl);
});
}
}) ;
DEMO