aureliaaurelia-templating

Aurelia compose with globalResources


Our plan is the following: A dashboard with webparts. We plan on develop many different "webparts" (as custom elements), and later, based on role or preferences we will show just a selection of the availible webparts.

Say I have the following custom elements in a dashboard.

<template>
   <my-webpart1 state.bind="state"></my-webpart1>
   <my-webpart2 state.bind="state"></my-webpart2>
   <my-webpart3 state.bind="state"></my-webpart3>
   <my-webpart4 state.bind="state"></my-webpart4>
   <my-webpart5 state.bind="state"></my-webpart5>
</template>

Is it possible to iterate over the names instead?

<div repeat.for="webpartname of manager.webparts">
  <compose view-model="${webpartname}" ></compose>
</div>

First problem is that the webparts are developed in different features and is registered using .globalResources() - how can I get the url?

Then the second problem is how to do the binding. I've not started on that yet.

Any ideas on how to solve this?

Regards

Larsi


Solution

  • Use if.bind or show.bind attributes on each part instead of using compose.