Skip to content

Instantly share code, notes, and snippets.

@funky-jojo
Forked from niieani/app.html
Created September 14, 2016 13:00
Show Gist options
  • Save funky-jojo/a2f17028d45ea202cd19be5491272dde to your computer and use it in GitHub Desktop.
Save funky-jojo/a2f17028d45ea202cd19be5491272dde to your computer and use it in GitHub Desktop.
Aurelia Gist [Demonstrate dynamic compose]
<template>
<h2>dynamic view model by path</h2>
<button click.trigger="loadNewViewModel()">Load different vm</button>
<compose view-model="${currentViewModel}"></compose>
</template>
export class App {
currentViewModel = "test.js";
loadNewViewModel(){
this.currentViewModel = "new.js"
}
}
<!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://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>
<template>
<h3>I am a new view</h3>
</template>
export class New{
}
<template>
<h4>I am the test view</h6>
</template>
export class Test {
constructor() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment