I don't think repeating over a list of elements is working.
You should only repeat over model data.
What your code does, is
<template repeat="{{track in tracks}}">
<example-track></example-track> <!-- this element is created tracks.lenght times -->
</template>
the content of your tracks
list is ignored completely (beside the number of entries) because you don't refer to it in your markup. You would get the same example if you use @observable List tracks = [1, 2, 3, 4, 5];
You should call render()
in ExampleTrack
's attached()
instead.
This way you get data from your tracks
list to your created ExampleTrack
<template repeat="{{track in tracks}}">
<example-track someattribute="{{track.aField}}"></example-track>
</template>
If you want to trigger updates in your generated ExampleTrack
s, change the bound model value (tracks[0].aField = 'someNewValue';
) and let the ExampleTrack
do something in void someattributeChanged(old) { /* do something */ }
You have to take care, that tracks
and the elements inside it and their fields are observable.
Search for [dart] observable
on SO there should be enough examples.