angularjs - Create Angular directive that keeps original element's attributes -
i've seen other questions kind of ask this, have unique complication thrown in, , answer seems surprisingly complicated in proportion simplicity of desired result. i'd ask simplest possible version of question.
let's have directive looks this:
<my-input type="text" placeholder="foo">
i want output this:
<input type="text" placeholder="foo" class="bar">
all want output new element , add new attributes, keep original element's attributes. how can achieved?
use attribute directive rather element:
<input type="text" placeholder="foo" my-directive>
and make mydirective
add desired new attributes element.
Comments
Post a Comment