"other" frameworks
threepointone opened this issue · 5 comments
frameworks that use jsx/virtual dom should be able to use this out of the box. however, not sure how to apply these data attributes in angular/ember templates. keeping this issue open to investigate; please help/contribute!
Angular JS comes with ng-attr-*
and ng-class
. So usage is something like
<div class="text-center" ng-class="{'text-danger': someBoolValue}">Foobar</div>
which would apply the text-danger
class if someBoolValue
is true
Reference: https://docs.angularjs.org/guide/interpolation
ps: Hope this is what you were looking for. I'm slightly new to frontend stuff, so might be wrong
I think for libraries and frameworks that don't use a virtual dom, then there will always be an integration step to sync the changes.
For libraries that don't use JSX, but do use a virtual DOM you can possibly just use Object.assign()
.
For example, Skate uses Incremental DOM and JSX is optional. So you can either:
<div {...style({}) } someattr="test" />
Or:
skate.vdom.element('div', Object.assign({}, style({}), { someattr: 'test' }));
couldn't figure out ember or angular templates. closing this issue, I think the main ones are covered.
fyi - ember/angular templates can use classname support now, so this is simpler