-
-
Save gordon-matt/e63df29cc4bfcc17c700f30a35e2f350 to your computer and use it in GitHub Desktop.
select init
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> | |
<p><strong>OPEN Console window first, to see values when clicking the buttons</strong></p> | |
<p>What I would like (in some cases, I populate the values myself - generated by ASP.NET Razor HTML helper):</p> | |
<select value.bind="pageTypeId"> | |
<option value="0bedc229-2280-46fa-b157-bce4f1cddeaa">Standard Page</option> | |
</select> | |
<button click.delegate="showValue()">Show Value</button> | |
<p>This way forces user to select an option:</p> | |
<select value.bind="pageTypeId2"> | |
<option value="" disabled="disabled">Select...</option> | |
<option repeat.for="option of pageTypes" value.bind="option.value">${option.label}</option> | |
</select> | |
<button click.delegate="showValue2()">Show Value</button> | |
<p>This works well (don't have to select an option) (but it has an empty option, which is not ideal):</p> | |
<select value.bind="pageTypeId3"> | |
<option model.bind="undefined" disabled>Select...</option> | |
<option repeat.for="option of pageTypes" value.bind="option.value">${option.label}</option> | |
</select> | |
<button click.delegate="showValue3()">Show Value</button> | |
</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
export class App { | |
pageTypeId = ''; | |
pageTypeId2 = ''; | |
pageTypeId3 = ''; | |
constructor(){ | |
this.pageTypes = [ | |
{label: "Standard Page", value: "0bedc229-2280-46fa-b157-bce4f1cddeaa"} | |
]; | |
} | |
showValue(){ | |
console.log('val: ' + this.pageTypeId); | |
} | |
showValue2(){ | |
console.log('val: ' + this.pageTypeId2); | |
} | |
showValue3(){ | |
console.log('val: ' + this.pageTypeId3); | |
} | |
} |
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="main"> | |
<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 function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging('warn'); | |
aurelia.start().then(() => aurelia.setRoot()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment