Directive, wrap content and keep attributes on original element Directive, wrap content and keep attributes on original element angularjs angularjs

Directive, wrap content and keep attributes on original element


As far as I know, the only way to do this is to specify the directive with transclusion in a wrapper element, e.g.:

<div mlb-select>    <select ...></select></div>

Of course there is no point in doing this if youe case is exactly as above.

Transclusion in the context of this question roughly works as:

  1. The transcluded content is the content of the element that has the directive with transclude: true; in your case the content of the <select>, which is empty!

  2. The transcluded content is placed inside the element that specifies ng-transclude in the template of the directive.