Skip to content

Instantly share code, notes, and snippets.

@MaximBalaganskiy
Created May 31, 2018 00:57
Show Gist options
  • Save MaximBalaganskiy/981a01f4ae9d7ecca083e1ef9c89913a to your computer and use it in GitHub Desktop.
Save MaximBalaganskiy/981a01f4ae9d7ecca083e1ef9c89913a 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>
<md-input md-autocomplete="values.bind: values;" label="put some text here" value.bind="textValue" disabled.bind="disabledValue"
md-on-autocomplete.delegate="autocomplete($event.detail)" change.delegate="change($event.detail)"></md-input>
<br /> You entered: ${textValue}
<br />
</div>
<div>
Values:
<pre>
${values|stringify}
</pre>
</div>
<div>
<button md-button click.delegate="setOtherValues()">set other values</button>
</div>
<div>
<logger class="z-depth-1" view-model.ref="logger"></logger>
</div>
</template>
import { Logger } from "../../../shared/logger";
export class App {
logger: Logger;
textValue = "";
values: any = {
Apple: null,
Microsoft: null,
Google: "http://placehold.it/250x250",
};
setOtherValues() {
this.values = {
Aurelia: "http://placehold.it/250x250",
Angular: null,
Ember: null
};
}
autocomplete(detail) {
this.logger.log("autocomplete " + JSON.stringify(detail));
}
change(detail) {
this.logger.log("change " + JSON.stringify(detail));
}
}
// tslint:disable-next-line:max-classes-per-file
export class StringifyValueConverter {
toView(value) {
return JSON.stringify(value);
}
}
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