Created
August 7, 2017 10:58
-
-
Save davismj/01786388db5ae6cf241c6b604e18461b to your computer and use it in GitHub Desktop.
Aurelia Gist
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> | |
| date is ${date} | |
| </div> | |
| <div> | |
| myClass.date is ${myClass.date} | |
| </div> | |
| <div> | |
| Object.is(date, myClass.date) is ${is(date, myClass.date)} | |
| </div> | |
| <h2>Router View</h2> | |
| <router-view></router-view> | |
| </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 { inject } from 'aurelia-framework'; | |
| import { MyClass } from './myClass'; | |
| @inject(MyClass) | |
| export class App { | |
| constructor(myClass) { | |
| this.date = new Date(); | |
| this.myClass = myClass; | |
| } | |
| configureRouter(config, router) { | |
| config.map([ | |
| { route: '', redirect: 'a' }, | |
| { route: 'a', moduleId: 'myViewModelA' }, | |
| { route: 'b', moduleId: 'myViewModelB' } | |
| ]); | |
| } | |
| is(a, b) { | |
| return Object.is(a, b); | |
| } | |
| } |
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"> | |
| </head> | |
| <body aurelia-app> | |
| <h1>Loading...</h1> | |
| <script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
| <script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
| <script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
| <script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
| <script> | |
| require(['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 } from 'aurelia-framework'; | |
| @inject(Date) | |
| export class MyClass { | |
| constructor(date) { | |
| this.date = date; | |
| } | |
| } |
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> | |
| <h2>Route A</h2> | |
| <div>Date is: ${date.toGMTString()}</div> | |
| <a href="#/b">Navigate to B</a> | |
| </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 { inject } from 'aurelia-framework'; | |
| @inject(Date) | |
| export class MyViewModelA { | |
| constructor(date) { | |
| this.date = date; | |
| } | |
| } |
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> | |
| <h2>Route B</h2> | |
| <div>Date is: ${date.toGMTString()}</div> | |
| <a href="#/a">Navigate to A</a> | |
| </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 { inject } from 'aurelia-framework'; | |
| @inject(Date) | |
| export class MyViewModelB { | |
| constructor(date) { | |
| this.date = date; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment