Skip to content

Instantly share code, notes, and snippets.

@jdanyow
Created May 20, 2017 04:53
Show Gist options
  • Save jdanyow/d736a4c59bed2032017fe286e74ec5ee to your computer and use it in GitHub Desktop.
Save jdanyow/d736a4c59bed2032017fe286e74ec5ee to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<h1 foo-bar-baz.attr="message">${message}</h1>
</template>
import {SyntaxInterpreter} from 'aurelia-templating-binding';
import {BehaviorInstruction} from 'aurelia-templating';
import {BindingExpression, BindingBehavior} from 'aurelia-binding';
SyntaxInterpreter.prototype.attr = function(resources, element, info, existingInstruction, context) {
const instruction = existingInstruction || BehaviorInstruction.attribute(info.attrName);
const expression = new BindingBehavior(this.parser.parse(info.attrValue), 'attr', []);
instruction.attributes[info.attrName] = new BindingExpression(
this.observerLocator,
info.attrName,
expression,
info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context),
resources.lookupFunctions
);
return instruction;
}
export class App {
message = 'Hello World!';
}
<!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