Suppose I have a CARD directive
.directive('card', [function() {
return {
restrict: 'E',
templateUrl: 'scripts/directives/card.html'
};
and the controller say CARDCONTROLLER
.controller('cardController',function($scope){
$scope.directivename = 'card';
});
and the HTML file says CARD.HTML
<div>
<{{directivename}}></{{directivename}}>
</div>
But the above does not work.
Does anyone have any ideas on how to do this?
EDIT. I do not want to generate the directive dynamically. It’s just that I want to bind it through the controller without changing anything in the directive
source
share