Skip to content

Instantly share code, notes, and snippets.

@TomasKulhanek
Forked from jdanyow/app.html
Last active August 15, 2018 10:45
Show Gist options
  • Save TomasKulhanek/b712431087519a20d1a29c88906b7fe9 to your computer and use it in GitHub Desktop.
Save TomasKulhanek/b712431087519a20d1a29c88906b7fe9 to your computer and use it in GitHub Desktop.
Aurelia Gist
<template>
<require from='./mybind'></require>
<p ref="myparagraph" mybind="Add other text. ">Some text here. </p>
</template>
export class App {
constructor() { }
attached() {
this.mytext = this.myparagraph.innerHTML;
this.manipulatecontent();
}
manipulatecontent() {
this.mytext += 'Hello world.';
this.myparagraph.innerHTML=this.mytext
}
}
<!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://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
export class MybindCustomAttribute {
static inject = [Element];
constructor(element){
this.element = element;
}
valueChanged(newValue, oldValue){
console.log("valuechanged()",newValue);
this.element.innerHTML += newValue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment