Last active
March 17, 2016 06:53
-
-
Save opcodewriter/984cd906bbc27eedc52a to your computer and use it in GitHub Desktop.
Aurelia Custom H Tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from='dynamic-header'></require> | |
<dynamic-header containerless></dynamic-header> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="outerHtmlAttribute"></require> | |
<!--<span innerhtml.bind="innerHtml()"> </span>--> | |
<h1 outer-html.bind="level">HELLO</h1> | |
</template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {bindable, inject} from 'aurelia-framework'; | |
@inject(Element) | |
export class DynamicHeader { | |
@bindable level = "1"; | |
/*innerHtml() | |
{ | |
return `<h${this.level}>Header 1</h${this.level}>`; | |
}*/ | |
constructor(element) | |
{ | |
this.element = element; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="styles.css"> | |
</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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {inject, customAttribute} from 'aurelia-framework'; | |
@customAttribute('outer-html') | |
@inject(Element) | |
export class OuterHtmlAttribute { | |
constructor(element) { | |
this.element = element; | |
} | |
valueChanged(newValue, oldValue) { | |
this.element.outerHTML = `<h${newValue}>${this.element.innerHTML}</h${newValue}>`; | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a { | |
display: block; | |
} | |
a:link { | |
color: black; | |
text-decoration: none; | |
} | |
.collection-item | |
{ | |
background: lightgray; | |
} | |
/* since you set background property on .collection-item, this style must come after .collection-item otherwise it's not applied */ | |
.active { | |
background: blue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment