Last active
March 9, 2016 11:04
-
-
Save opcodewriter/b50643a0f6ad2d99273d to your computer and use it in GitHub Desktop.
Aurelia ContentControl
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="./contentControl.html"></require> | |
<require from="./myCustomComponent"></require> | |
<content-control content-template='myCustomTemplate.html' content='this is content rendered with myCustomTemplate'></content-control> | |
<!-- set a template of a another component--> | |
<!--<content-control content-template='myCustomComponent' content='this doesnt matter'></content-control> --> | |
<!-- set actual content with an instance of another component--> | |
<content-control> | |
<my-custom-component text="Hello"></my-custom-component> | |
</content-control> | |
</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 bindable='content,contentTemplate'> | |
<compose if.bind='contentTemplate' view='${contentTemplate}' containerless></compose> | |
<!-- how to make this containerless too? --> | |
<div if.bind='!contentTemplate'> | |
${content} | |
</div> | |
<content></content> | |
</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} from 'aurelia-framework'; | |
export class ContentControl | |
{ | |
@bindable content; | |
@bindable contentTemplate; | |
} |
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/master/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/master/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
<template> | |
<button>${text}</button> | |
</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} from 'aurelia-framework' | |
export class MyCustomComponent | |
{ | |
@bindable text; | |
} |
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> | |
<div style="background:lightblue">${content}</div> | |
</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
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