-
-
Save plwalters/7b9d230f7d3c6dc8c13cefdd7be50c7f to your computer and use it in GitHub Desktop.
aurelia:complex type, clear input
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> | |
<select value.bind="val" if.bind="opts && !val"> | |
<option repeat.for="opt of opts" model.bind="opt">${opt.firstName}</option> | |
</select> | |
<div if.bind="!opts || val"> | |
<span>${val.firstName}</span> | |
<button click.delegate="clearVal()" if.bind="val">Clear</button> | |
</div> | |
<button click.delegate="getOpts()">Get</button> | |
<template with.bind="val.address"> | |
<input type="text" value.bind="line1" /> | |
</template> | |
</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 { | |
opts; | |
val; | |
getOpts(){ | |
this.opts = [ | |
undefined, | |
{ | |
blah: 1, | |
firstName: 'foo', | |
address: { | |
line1: '123 Main St.' | |
} | |
}, | |
{ | |
blah: 2, | |
firstName: 'bar', | |
address: { | |
line1: '456 Other Wy.' | |
} | |
} | |
]; | |
} | |
clearVal(){ | |
this.val = null; | |
} | |
} | |
class Option { | |
blah; | |
firstName = ''; | |
address = { | |
line1: '' | |
} | |
} |
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="main"> | |
<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 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 function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging(); | |
aurelia.start().then(() => aurelia.setRoot()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment