-
-
Save bigopon/b0803983cdb504a8d96e2fa9364d5ab6 to your computer and use it in GitHub Desktop.
aurelia2-custom-elements
This file contains 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> | |
<meta charset="utf-8"> | |
<title>Dumber Gist</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"> | |
<base href="/"> | |
</head> | |
<!-- | |
Dumber Gist uses dumber bundler, the default bundle file | |
is /dist/entry-bundle.js. | |
The starting module is pointed to "main" (data-main attribute on script) | |
which is your src/main.js. | |
--> | |
<body> | |
<my-app></my-app> | |
<script src="/dist/entry-bundle.js" data-main="main"></script> | |
</body> | |
</html> |
This file contains 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
{ | |
"dependencies": { | |
"aurelia": "latest" | |
} | |
} |
This file contains 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
<div style="color: red; border: 1px solid red">This is custom element A</div> |
This file contains 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 { customElement, bindable } from "aurelia"; | |
import template from "./custom-element-a.html"; | |
@customElement({ name: "custom-element-a", template }) | |
export class CustomElementA { | |
} |
This file contains 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 from="./custom-element-a"></import> | |
<div style="border: 1px solid blue"> | |
<div style="color: blue">This is custom element B</div> | |
<span>And here should be custom element A:</span> | |
<custom-element-a></custom-element-a> | |
<span>(but it is not rendered)</span> | |
</div> |
This file contains 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 { customElement, bindable } from "aurelia"; | |
import template from "./custom-element-b.html"; | |
@customElement({ name: "custom-element-b", template }) | |
export class CustomElementB { | |
} |
This file contains 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 Aurelia from 'aurelia'; | |
import { MyApp } from './my-app'; | |
Aurelia.app(MyApp).start(); |
This file contains 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 from="./custom-element-a"></import> | |
<import from="./custom-element-b"></import> | |
<h1>Custom elements</h1> | |
<h2>Custom element A directly under app</h2> | |
<custom-element-a></custom-element-a> | |
<h2>Custom element A inside custom element B</h2> | |
<custom-element-b></custom-element-b> |
This file contains 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 MyApp { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment