Skip to content

Instantly share code, notes, and snippets.

@ZoolWay
Last active February 10, 2017 16:25
Show Gist options
  • Save ZoolWay/b7a304bec9f097f1d95f163b0d066715 to your computer and use it in GitHub Desktop.
Save ZoolWay/b7a304bec9f097f1d95f163b0d066715 to your computer and use it in GitHub Desktop.
button disabled
<template>
<require from="my-button"></require>
<h1>${message}</h1>
<div>
<my-button>Button 1</my-button>
<my-button is-enabled="false">Button 2</my-button>
<my-button is-enabled.bind="isButton3Enabled">Button 3</my-button>
<my-button is-enabled.bind="isButton4Enabled">Button 4</my-button>
</div>
<div>
<button click.delegate="toggleButton3()">Toggle Button 3</button>
<button click.delegate="toggleButton4()">Toggle Button 4</button>
</div>
</template>
export class App {
message = 'Hello World';
isButton3Enabled = true;
isButton4Enabled = false;
toggleButton3() {
this.isButton3Enabled = !this.isButton3Enabled;
}
toggleButton4() {
this.isButton4Enabled = !this.isButton4Enabled;
}
}
import {inject} from 'aurelia-dependency-injection'
export class Action1Dependency {}
export class Action2Dependency {}
export class ActionBase{
}
@inject(Action1Dependency)
export class Action1 extends ActionBase{
constructor(dep){
super();
this.dep = dep;
}
}
@inject(Action2Dependency)
export class Action2 extends ActionBase{
constructor(dep){
super();
this.dep = dep;
}
}
<!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>
<template>
<button disabled.bind="!isEnabled"><slot></slot><content></content></button>
</template>
import { bindable } from 'aurelia-framework'
export class MyButton {
@bindable isEnabled = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment