javascript - Directive's inner HTML interpolated value -
let's have piece of code:
<div>{{somevalue}}</div>
i want came generic directive append css class based on interpolated value of {{somevalue}}
in above example.
example:
<div status>{{somevalue}}</div>
would result in
<div class="green">ok</div>
when {{somevalue}}
expression equal ok
.
otherwise stay untouched.
i know other ways achieve same result (e.g. ngclass
) know whether it's possible achieve described above - based on interpolated value of directive's inner html.
p.s.: don't want tie directive actual model - instead directive act based on interpolated value of inner html. hope clear enough...
i suggest use somevalue
attribute value, can available directive , make life lot easier.
<div status="{{somevalue}}"></div>
then, can loop through somevalue
value inside directive's link function, , send appropriate status message.
Comments
Post a Comment