Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move aurelia-app attribute to another html element?

Tags:

html

aurelia

All the examples for aurelia seem to place the aurelia-app directive on the <body> element.

Can aurelia-app be placed on other html elements, rather than on <body>? If so, would there be a reason to avoid doing so?

like image 361
Meirion Hughes Avatar asked May 18 '16 08:05

Meirion Hughes


1 Answers

The official documentation states:

Simply place this on an HTML element and Aurelia's bootstrapper will load an app.js and app.html, databind them together and inject them into the DOM element on which you placed that attribute.

I tested this with:

<body>
  <div aurelia-app="app-window">
  </div>
  ...
</body>

and it does indeed appear to inject your aurelia app at that point:

enter image description here

What I don't know is if this is a good idea or not, i.e. if there going to be unforeseen problems by doing this.

like image 146
Meirion Hughes Avatar answered Nov 05 '22 04:11

Meirion Hughes