Skip to content

Instantly share code, notes, and snippets.

@AshleyGrant
Forked from avrahamcool/app.html
Last active September 5, 2017 15:51
Show Gist options
  • Save AshleyGrant/f5a165c276274f868256f0a849c55b8c to your computer and use it in GitHub Desktop.
Save AshleyGrant/f5a165c276274f868256f0a849c55b8c to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<require from="stringify"></require>
<h1>${message}</h1>
<div repeat.for="i of arr">
i = ${i}
<br/>
$parent.message = ${$parent.message}
<br/>
$parent.someVar = ${$parent.someVar}
<br/>
$parent = ${$parent}
<br/>
$parent.message with conveter = ${$parent.message | stringify}
<br/>
$parent.someVar with conveter = ${$parent.someVar | stringify}
<br ref="temp" parent.bind="$parent"/>
<!--
uncomment this to show the buggy behaviour -->
$parent with conveter = ${ temp.parent | stringify}
</div>
</template>
export class App {
message = 'Hello World!';
someVar = {a: 12};
arr = [1]
}
<!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>
export class stringifyValueConverter
{
toView(obj)
{
return "Converted " + (obj && JSON.stringify(obj));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment