Repeater and parent binding


#1

Hi,

I have some repeater, that gets data from:

var Observable = require("data/observable").Observable;
exports.loaded = function(args) {
var model = new Observable();
var page = args.object;

model.items = [1,2,3,4];
model.set('data','data);

page.bindingContext = model;
};
<Repeater items="{{ items }}">
<Repeater.itemTemplate>
<StackLayout>
<!-- This works fine -->
<Label text={{items}}></Label>
<!-- now i want to bind model.data value and this is not working -->
<Label text={{data}}></Label>
</StackLayout>
</Repeater.itemTemplate>
</Repeater>

The Repeater is not seeing this ‘data value’ so my question is how to get this ?
Thanks you.


#2

There is a syntax error in your code: model.set('data','data); has an extra ’

But the problem is data doesn’t correlate to anything in your items array. Try this instead:

model.set("items", [{data:1}, {data:2}, {data:3}]);


#3

Thank you @roblauer, i will check this.