Dynamically adding an attribute Directive to a transclude Directive in AngularJS
问题 I'm attempting to dynamically add an attribute Directive to a transclude directive. For example, the template would start off as follows: <div class="container"> <div ng-transclude></div> </div> After an event takes place (eg. a click), it would then have an attribute Directive added, such as: <div class="container" some-directive> <div ng-transclude></div> </div> I'm using the following JavaScript to do this: div = angular.element("#demoParentDirective .container").clone(); div.attr('some