Last active
March 8, 2017 16:00
-
-
Save fabioluz/f7f89f35b62acb5b4f05ffe59be1880e to your computer and use it in GitHub Desktop.
This file contains hidden or 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="./optional-title"></require>--> | |
| ${message} | |
| <br> | |
| <select> | |
| <option repeat.for="option of options" my-optional-title.bind="option.title"> | |
| ${option.name} | |
| </option> | |
| </select> | |
| </template> |
This file contains hidden or 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 { customAttribute } from 'aurelia-framework'; | |
| export class App { | |
| message = 'Hello World!'; | |
| options = [ | |
| { name: '1' }, | |
| { name: '2', title: 'adf' }, | |
| { name: '3', title: 'aaa' } | |
| ]; | |
| } | |
| @customAttribute('my-optional-title') | |
| export class SomeClassName { | |
| static inject = [Element]; | |
| constructor(element) { | |
| this.element = element; | |
| } | |
| valueChanged(newValue) { | |
| if (newValue) { | |
| this.element.setAttribute('title', newValue); | |
| } else { | |
| this.element.removeAttribute('title'); | |
| } | |
| } | |
| } |
This file contains hidden or 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://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> |
This file contains hidden or 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 OptionalTitleCustomAttribute { | |
| static inject = [Element]; | |
| constructor(element) { | |
| this.element = element; | |
| } | |
| valueChanged(newValue) { | |
| if (newValue) { | |
| this.element.setAttribute('title', newValue); | |
| } else { | |
| this.element.removeAttribute('title'); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment