Skip to content

Instantly share code, notes, and snippets.

@AshleyGrant
Last active September 26, 2017 14:39
Show Gist options
  • Save AshleyGrant/864edc684eb107cdd71c58785b14d2f9 to your computer and use it in GitHub Desktop.
Save AshleyGrant/864edc684eb107cdd71c58785b14d2f9 to your computer and use it in GitHub Desktop.
Aurelia Calls Function
<template>
<require from="./calls-function"></require>
<calls-function passed-in-function.call="myFunc(paramOne, paramTwo)"></calls-function>
Text: ${text}<br />
</template>
export class App {
myFunc(paramOne, paramTwo) {
this.text = `paramOne: ${paramOne}, paramTwo: ${paramTwo}`;
}
}
<template>
<div>
<div>
First Name:
<input type="text" value.bind="firstName" />
</div>
<div>
Last Name:
<input type="text" value.bind="lastName" />
</div>
<button click.trigger="doStuff()">Do Stuff</button>
</div>
</template>
import {bindable} from 'aurelia-framework';
export class CallsFunction {
@bindable passedInFunction;
doStuff() {
this.passedInFunction({ paramOne: this.firstName, paramTwo: this.lastName });
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app>
<h1>Loading...</h1>
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script>
<script>
require(['aurelia-bootstrapper']);
</script>
</body>
</html>
import {inject} from 'aurelia-framework';
@inject(Element)
export class KeyboardCustomAttribute {
constructor(el) {
this.el = el;
}
attached() {
$(this.el).keyboard({
layout: 'qwerty'
})
// activate the typing extension
.addTyping({
showTyping: true,
delay: 250
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment