Skip to content

Instantly share code, notes, and snippets.

@Vheissu
Last active June 28, 2017 06:32
Show Gist options
  • Save Vheissu/a815667083dbd26a1d04ea09d117d86e to your computer and use it in GitHub Desktop.
Save Vheissu/a815667083dbd26a1d04ea09d117d86e to your computer and use it in GitHub Desktop.
Access Aurelia container
<template>
<require from="./auth-attribute"></require>
<h1>Shibby</h1>
<button disabled.bind="buttonState" click.delegate="handleClick()" auth="disabled.bind: buttonState;">My Button</button>
</template>
export class App {
buttonState = false;
handleClick() {
console.log('Clicked from within app');
}
}
import {bindable} from 'aurelia-framework';
export class AuthCustomAttribute {
@bindable disabled;
@bindable cats;
static inject = [Element];
constructor(el) {
this.element = el;
}
disabledChanged() {
console.log(this.element.au);
}
}
<!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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment