Created
April 22, 2021 19:33
-
-
Save gimerstedt/04f97edc4407306172e6eb82062d7657 to your computer and use it in GitHub Desktop.
service-help
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> | |
| <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.ts. | |
| --> | |
| <body> | |
| <my-app></my-app> | |
| <script src="/dist/entry-bundle.js" data-main="main"></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
| { | |
| "dependencies": { | |
| "aurelia": "latest" | |
| } | |
| } |
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 DataService { | |
| data: number | string = 'not data quite yet' | |
| setImportantData(data: 42) { | |
| if(Math.random() > .2) { | |
| this.data = data | |
| } else { | |
| this.data = data * 10 | |
| } | |
| } | |
| } |
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 Aurelia from 'aurelia'; | |
| import { MyApp } from './my-app'; | |
| Aurelia.app(MyApp).start(); |
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 { customElement } from 'aurelia' | |
| import { TheButton } from './the-button' | |
| import { TheOtherThing } from './the-other-thing' | |
| import template from './my-app.html' | |
| @customElement({ | |
| name: 'my-app', | |
| template: ` | |
| <h1>\${message}</h1> | |
| <the-button></the-button> | |
| <the-other-thing></the-other-thing> | |
| `, | |
| dependencies: [TheButton, TheOtherThing] | |
| }) | |
| export class MyApp { | |
| public message: string = 'Hello Aurelia 2!'; | |
| } |
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 { customElement } from 'aurelia' | |
| import { DataService } from './data-service' | |
| @customElement({ | |
| name: 'the-other-thing', | |
| template: `<h1>\${service.data}</h1>` | |
| }) | |
| export class TheOtherThing { | |
| constructor(private readonly service: DataService) {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment