Last active
June 6, 2018 21:03
-
-
Save AshleyGrant/7587f1453cb2632fa09b6fe542d9717c to your computer and use it in GitHub Desktop.
Working with Focus
This file contains 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> | |
<require from="./some-element"></require> | |
<label for="hasFocus">Has Focus:</label> <input id="hasFocus" type="checkbox" checked.bind="focus" /> | |
<div> | |
Custom Element: | |
<some-element has-focus.bind="focus" text.bind="text"></some-element> | |
</div> | |
<div> | |
Regular text box: | |
<input type="text" value.bind="text" /> | |
</div> | |
</template> |
This file contains 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 class App { | |
focus = false; | |
text = 'Hello'; | |
setText() { | |
this.text += '-'; | |
} | |
} |
This file contains 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> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains 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> | |
<input ref="textbox" type="text" value.bind="text" focus.bind="hasFocus" /> | |
</template> |
This file contains 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 {bindable, bindingMode} from 'aurelia-framework'; | |
export class SomeElement { | |
@bindable({ defaultBindingMode: bindingMode.twoWay }) text; | |
@bindable({ defaultBindingMode: bindingMode.twoWay }) hasFocus; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment