Skip to content

Instantly share code, notes, and snippets.

@Thanood
Last active December 22, 2016 21:20
Show Gist options
  • Save Thanood/b46c02e4e301e6ba5eab731b2650953c to your computer and use it in GitHub Desktop.
Save Thanood/b46c02e4e301e6ba5eab731b2650953c to your computer and use it in GitHub Desktop.
Aurelia-Materialize bridge dropdown repeat
<template>
<div class="dropdown-sample">
<table>
<tr repeat.for="n of 5">
<td>line ${n+1}</td>
<td>
<a md-button md-dropdown="ref.bind: dropdown;">drop me!</a>
<ul ref="dropdown">
<li><a click.trigger="showToast($event)">one</a></li>
<li><a click.trigger="showToast($event)">two</a></li>
<li class="divider"></li>
<li><a click.trigger="showToast($event)">three</a></li>
</ul>
</td>
</tr>
</table>
</div>
</template>
import { inject } from 'aurelia-framework';
import { MdToastService } from 'aurelia-materialize-bridge/toast/toastService';
@inject(MdToastService)
export class BasicUse {
constructor(toast) {
this.toast = toast;
}
showToast(e) {
this.toast.show(`You clicked ${e.target.innerText}`, 4000);
}
}
<!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.20.2/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