Skip to content

Instantly share code, notes, and snippets.

@deap82
Forked from jdanyow/app.html
Last active June 7, 2018 10:30
Show Gist options
  • Select an option

  • Save deap82/63cf42d8d753cdf62ff2c8c466a4f61e to your computer and use it in GitHub Desktop.

Select an option

Save deap82/63cf42d8d753cdf62ff2c8c466a4f61e to your computer and use it in GitHub Desktop.
aurelia-binding unicode escaping
<template>
<h1>${message}</h1>
</template>
import { inject, Aurelia, TemplatingEngine } from 'aurelia-framework';
@inject(Aurelia, TemplatingEngine)
export class App {
message = 'Hello \u000b World!';
templatingEngine;
constructor(aurelia, templatingEngine) {
this.aurelia = aurelia;
this.templatingEngine = templatingEngine;
}
attached() {
var enhanceInstruction = {
container: this.aurelia.container,
resources: this.aurelia.resources,
bindingContext: { "message": "Hello \u000b World!" },
element: document.getElementById('enhanced')
};
this.templatingEngine.enhance(enhanceInstruction);
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<div 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>
</div>
<div id="enhanced" style="border: dashed gray 1px; padding: 10px; margin-top: 20px;">
This area is enhanced.<br>
${ message }
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment