Aurelia recently added support for layouts, and they roughly explained those in their documentation.
However, while I managed to get the layouting itself to work, I cannot use any variables in my layout-HTML which I have as properties in my Layout-ViewModel.
A MWE:
app.ts
import {Router, RouterConfiguration} from 'aurelia-router';
export class App {
router: Router;
configureRouter(config: RouterConfiguration, router: Router) {
config.map([
{ route: 'hello', layoutViewModel: 'layout/main', moduleId: 'hello/index' },
]);
}
}
layout/main.ts
export class MainLayout {
heading = 'Hallo Welt';
}
layout/main.html
<template>
<h1>${heading}!</h1>
</template
But only the exclamation point occurs. Do you have any ideas what I am doing wrong or how I can get it to work?
Many thanks in advance!
hello/index
aren't you supposed to be doing the assigning inhello/index
and notlayout/main
? – Cornerhello/index
module – SpragginsmoduleId
tolayoutModel
. Might be what you are looking for. – Corner