Skip to content

Instantly share code, notes, and snippets.

@MaximBalaganskiy
Created May 23, 2018 12:36
Show Gist options
  • Save MaximBalaganskiy/7f40a3fcf76e7ef260a785ce783d1f2f to your computer and use it in GitHub Desktop.
Save MaximBalaganskiy/7f40a3fcf76e7ef260a785ce783d1f2f to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<div aurelia-app="src/configure">
Loading...
</div>
<script src="https://rawgit.com/aurelia-ui-toolkits/demo-materialize/gh-pages/jspm_packages/system.js"></script>
<script src="https://rawgit.com/aurelia-ui-toolkits/demo-materialize/gh-pages/jspm.config.js"></script>
<script>
System.import("aurelia-bootstrapper");
</script>
</body>
</html>
<template>
<div>
<p><a md-button click.trigger="showDefaultToast()">default toast</a></p>
<p style="margin-top: 5px;"><a md-button click.trigger="showToastWithPromise()">toast with callback</a></p>
<p style="margin-top: 5px;"><a md-button click.trigger="showStyledToast()">toast with style</a></p>
</div>
</template>
import { autoinject } from "aurelia-framework";
import { MdToastService } from "aurelia-materialize-bridge";
@autoinject
export class App {
constructor(private toast: MdToastService) {
this.toast = toast;
}
showDefaultToast() {
this.toast.show("I am a toast!", 4000);
}
showStyledToast() {
this.toast.show("I've got style!", 4000, "rounded blue");
}
showToastWithPromise() {
this.toast.show("When finished, I trigger another toast.", 2000).then(() => {
this.toast.show("I am a toast called by a callback of another toast!", 2000);
});
}
}
export async function configure(aurelia) {
await aurelia.loader.loadModule("materialize-css");
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin("aurelia-materialize-bridge", bridge => bridge.useAll())
.plugin("aurelia-validation")
.globalResources("src/shared/logger");
await aurelia.start();
aurelia.setRoot("src/app");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment