<rant>
As a dabbler in web-development I must admit that I don’t find going from Aurelia 1 to Aurelia 2 a smooth ride. E.g. in the section on Migrating from Aurelia <compose>
we find the following statement The same ease of use is still there...
and then it goes on to say that if you want a view supporting a dynamically loaded module, you can create a value converter(!) for this
and then goes on to show a template
attribute being assigned a full URL, while I guess most devs. probably would like to know if a relative path can be used (as in v1) or if an absolute path/url is required. I’m looking from this in the small
so to say, but I fail to see the rational for removing something that was very easy to understand.
(Btw, I do not find going from the old router to the new router(s) easy either).
However, not being a full-time web-developer I understand that the problem may be a PEBKAC problem, but my customer has teams using Angular or React and our team is under pressure to ditch Aurelia. If the path to v2 is viewed as difficult, people might be tempted to go for e.g. React since they will be learning something (almost completely) new anyway.
</rant>
Now to the problem at hand. I have created a view (no view model) like this (status-view.html):
<bindable="ws"></bindable>
<div class="card" style="margin-right: 0.75rem;">
<img src.bind="ws.country.imageName" alt="country flag" class="card-image-top">
<div class="card-body">
<h5 class="card-title">Uke ${ws.weekNumber}</h5>
<div class="list-group">
<div class="list-group-item">
<div>
<div class="row">
<div class="col-sm-10">
<p>Fullst.kontroll</p>
</div>
<div class="col-sm-2">
<span class="text-align: center;">✓</span>
</div>
</div>
<div class="row">
<div class="col-sm-10">
<p>Status</p>
</div>
<div class="col-sm-2">
<span class="text-align: center;">✓</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
with the containing view looking like this (status-list-view.html):
<import from="./status-view.html"></import>
<div class="card-group">
<status-view repeat.for="weekstatus of weekStatuses" ws.bind="weekstatus"></status-view>
</div>
with the corresponding view model looking like (status-list-view.ts):
import { customElement } from "aurelia";
import { CountryService } from "../resources/services/country-service";
import { WeekStatus } from "../resources/types/week-status";
@customElement('status-list-view')
export class StatusListView {
weekStatuses : Array<WeekStatus>;
constructor(countryservice: CountryService) {
this.weekStatuses = countryservice.getStatusPerCountry();
}
}
When run I can set a break-point in the constructor and see that the array indeed contains the expected values with all properties set, but when the status-view is rendered no values from the bound parameter is shown. Can someone please tell me what I’m doing wrong? I’ve tried to follow the to-do example code
but while it works (I guess), my code doesn’t.
TIA
–norgie