Created
May 10, 2018 10:11
-
-
Save champolot/957b33f3d8c198e99c70d1f74fa2491e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div md-chips="data.bind: chips; placeholder:+tag;" change.delegate="logChange($event.detail)" selected.delegate="logSelect($event.detail)"></div> | |
<div> | |
<!-- chip data: ${chips|stringify} --> | |
chip data: | |
<ul> | |
<li repeat.for="chip of chips"> | |
${chip.tag} | |
</li> | |
</ul> | |
</div> | |
<button md-button md-waves="color: light;" click.delegate="addChip()">Add a chip</button> | |
<button md-button md-waves="color: light;" click.delegate="removeChip()">Remove last chip</button> | |
<div> | |
<logger class="z-depth-1" view-model.ref="logger"></logger> | |
</div> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Logger } from "../../../shared/logger"; | |
export class App { | |
logger: Logger; | |
chips = [{ tag: "Apple" }, { tag: "Microsoft" }, { tag: "Google" }]; | |
addChip() { | |
this.chips = this.chips.concat({ tag: "new chip" }); | |
} | |
removeChip() { | |
this.chips = this.chips.slice(0, this.chips.length - 1); | |
} | |
logChange(detail) { | |
this.logger.log(`chips changed: ${JSON.stringify(detail)}`); | |
} | |
logSelect(detail) { | |
this.logger.log(`chip selected: ${JSON.stringify(detail)}`); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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