-
-
Save BruceL33t/61b46106bc72ff29c96fa89dfc726887 to your computer and use it in GitHub Desktop.
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
<template> | |
<p>Parent App</p> | |
<require from="./child-app"></require> | |
<child-app main.bind="main1"></child-app> | |
<child-app main.bind="main2"></child-app> | |
</template> |
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 App { | |
main1 = './one/app'; | |
main2 = './two/app'; | |
} |
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, | |
noView, | |
bindable, | |
inject, | |
Container | |
} from 'aurelia-framework'; | |
import {Loader} from 'aurelia-loader'; | |
@noView() | |
@inject(Loader, Element) | |
export class ChildApp { | |
@bindable main; | |
constructor(loader, element) { | |
this.host = element; | |
this.app = new Aurelia(this.loader, new Container()); | |
this.app.use.standardConfiguration(); | |
} | |
mainChanged() { | |
this.app.start().then(a => a.setRoot(this.main, this.host)); | |
} | |
} |
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> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
child-app { | |
display: block; | |
border: 1px solid green; | |
} | |
</style> | |
</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 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> | |
<ul> | |
<li repeat.for = "row of router.navigation"> | |
<a href.bind = "row.href">${row.title}</a> | |
</li> | |
</ul> | |
<router-view></router-view> | |
</template> |
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 App { | |
message = 'I am a separate app!'; | |
configureRouter(config, router){ | |
config.title = 'Aurelia'; | |
config.map([ | |
{ route: ['','test'], name: 'test', | |
moduleId: '../test', nav: true, title:'Test' }, | |
{ route: ['test2'], name: 'home2', | |
moduleId: '../test2', nav: true, title:'Test2' } | |
]); | |
this.router = router; | |
} | |
} |
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
<template> | |
${message} | |
</template> |
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 Test { | |
message = 'test'; | |
} |
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
<template> | |
${message} | |
</template> |
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 Test2 { | |
message = 'test2'; | |
} |
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
<template> | |
${message} | |
</template> |
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 App { | |
message = 'I am another separate app!'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment