Reputation:
Can Onsen be used without Angular?
Can Aurelia data bind to Onsen?
Upvotes: 2
Views: 378
Reputation: 11725
Yes, it can be used without Angular.
You would need to take advantage of their css, and develop your custom components like the way they did for Angular.
For example, a simple ons-list
Custom Element would be something like:
<template>
<ul class="list ${inset ? 'list--inset' : ''}">
<content select="ons-list-header"></content>
<content select="ons-list-item"></content>
</ul>
</template>
import {bindable} from 'aurelia-framework'
export class OnsList {
@bindable inset = false;
}
<template>
<li class="list__header">
<content></content>
</li>
</template>
export class OnsListHeader {
}
<template>
<li class="list__item ${modifier === 'tappable' ? 'list__item--tappable' : modifier === 'chevron' ? 'list__item--chevron' : ''}">
<content></content>
</li>
</template>
import {bindable} from 'aurelia-framework'
export class OnsListItem {
@bindable modifier = ""; // other options: tappable | chevron
}
<template>
<ons-list>
<ons-list-header>My header</ons-list-header>
<ons-list-item>Item 1<ons-list-item>
<ons-list-item>${myDynamicItemVariable}</ons-list-item>
</ons-list>
</template>
Plunker: http://plnkr.co/edit/Lqm28H42zQbWiQBMHqXq?p=preview
Upvotes: 6