-
-
Save Nepoxx/7f5cc272d90638da5ee5ceddafcec2ee to your computer and use it in GitHub Desktop.
Aurelia Gist
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="keys"></require> | |
<require from="stringTypeOf"></require> | |
<require from="titlerize"></require> | |
<form class="form-horizontal form-label-left input_mask"> | |
<div class="form-group" repeat.for="key of data | keys"> | |
Key: ${key}, Value: ${data[key]} | |
<br> | |
<label class="control-label col-md-3 col-sm-3 col-xs-12">Title: ${key | titlerize}</label> | |
<div class="col-md-9 col-sm-9 col-xs-12"> | |
Compose:<compose view-model="${data[key] | stringTypeOf}-form" | |
view="${data[key] | stringTypeOf}-form.html" | |
model.bind="data[key]"></compose> | |
<br> | |
Direct:<input type="number" class="form-control" placeholder="0" min="0" value.bind="data[key]"> | |
</div> | |
</div> | |
<div class="ln_solid"></div> | |
</form> | |
</template> | |
6 |
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 { | |
data = {a: 5}; | |
} |
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 KeysValueConverter { | |
toView(object) { | |
return Object.keys(object); | |
} | |
} |
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> | |
<input type="number" class="form-control" placeholder="0" min="0" value.bind="model"> | |
</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 NumberForm { | |
activate(model) { | |
this.model = model; | |
} | |
} |
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 StringTypeOfValueConverter { | |
toView(object) { | |
return typeof object; | |
} | |
} |
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 TitlerizeValueConverter { | |
toView(camelCaseString) { | |
const string = camelCaseString.replace(/([A-Z]+)/g, " $1"); | |
return string.charAt(0).toUpperCase() + string.slice(1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment