Skip to content

Instantly share code, notes, and snippets.

@martonsagi
Last active October 5, 2016 09:03
Show Gist options
  • Save martonsagi/f0698d5b0066c3674c29c40d850217dc to your computer and use it in GitHub Desktop.
Save martonsagi/f0698d5b0066c3674c29c40d850217dc to your computer and use it in GitHub Desktop.
Aurelia HTML only element default values
<template>
<require from="./cust-elem.html"></require>
<cust-elem param1.bind="value1" param2.bind="value2"></cust-elem>
</template>
export class App {
value2 = 'default 2';
attached() {
setTimeout(() => {
this.value1 = 'new value 1'
}, 2000);
setTimeout(() => {
this.value2 = 'new value 2'
}, 1000);
}
}
<template bindable="param1,param2,param3">
<ul>
<li>Param1 value: '${param1 || 'default 1'}'</li>
<li>Param2 value: '${param2}'</li>
<li>Param3 value: '${param3 || 'default 3'}'</li>
</ul>
</template>
<!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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment