angularjs - Wrapping directive with HTML -


i hoping more straight forward, i'm stuck. i'm trying figure out how can wrap select html without disrupting select itself.

as far can see, if make directive called 'select', it'll trigger when add select html. , unless don't understand correctly, transclusion right means of doing this.

so setup simple enough directive add html around select, doesn't anything. if add both transclude: true , replace: true, sorta works, though takes attributes of select , moves template div.

i figured plnkr easiest way share code. should type out here too? http://plnkr.co/edit/mhadl7dkfrv7nechpxep?p=preview

if don't need write template html , want adjust dom around select element, 1 of simple way wrap directive this.

.directive('select', function(){     return {         restrict: 'e',         link: function(scope, element){             // adjust element want             //element.addclass('prettyselect');             element.wrap('<div class="prettyselect"></div>');         }     } }); 

jsfiddle here.


Popular posts from this blog