Skip to content

Instantly share code, notes, and snippets.

@Thanood
Last active February 22, 2017 19:47
Show Gist options
  • Save Thanood/130c68e94c3c0d5e26a1a64ef8658f08 to your computer and use it in GitHub Desktop.
Save Thanood/130c68e94c3c0d5e26a1a64ef8658f08 to your computer and use it in GitHub Desktop.
Aurelia-Materialize bridge au-md-tabs
<template>
<au-md-tabs md-stretch.bind="stretched" view-model.ref="demotabs">
<au-md-tab md-label="tab 1" class="z-depth-1" style="padding: 25px;">
This is tab 1
</au-md-tab>
<au-md-tab md-label="tab 2" class="z-depth-1" style="padding: 25px;">
This is tab 2
</au-md-tab>
<au-md-tab md-label="tab 3" class="z-depth-1" style="padding: 25px;">
This is tab 3
</au-md-tab>
<au-md-tab md-label="tab 4" class="z-depth-1" style="padding: 25px;">
This is tab 4
</au-md-tab>
<au-md-tab repeat.for="t of additionalTabs" md-label.bind="t.label" class="z-depth-1" style="padding: 25px;">
${t.content}
</au-md-tab>
</au-md-tabs>
<div>
selectedTab: ${demotabs.activeTab.mdLabel}
</div>
<div>
<md-checkbox md-checked.bind="stretched">stretch tabs</md-checkbox>
</div>
<div>
<button md-button="flat: true;" click.delegate="selectTab3()">select tab 3</button>
<button md-button="flat: true;" click.delegate="addTab()">add tab</button>
</div>
</template>
export class App {
additionalTabs = [];
stretched = false;
addTab() {
const id = this.additionalTabs.length + 5;
this.additionalTabs.push({
label: `tab ${id}`,
content: `This is tab ${id}`
});
}
selectTab3() {
this.demotabs.setActiveIndex(2);
}
}
export class StringifyValueConverter {
toView(value) {
return JSON.stringify(value);
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app="main">
<h1>Loading...</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script>
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-materialize-bundles/0.24.0-1/config2.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
/*******************************************************************************
* The following two lines enable async/await without using babel's
* "runtime" transformer. Uncomment the lines if you intend to use async/await.
*
* More info here: https://github.com/jdanyow/aurelia-plunker/issues/2
*/
//import regeneratorRuntime from 'babel-runtime/regenerator';
//window.regeneratorRuntime = regeneratorRuntime;
/******************************************************************************/
import 'materialize';
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-materialize-bridge', bridge => bridge.useAll() );
aurelia.start().then(a => a.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment