-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
If you run this example, Framework will only generate 1 div at position 50, 50 where I would expect it to create two, one at 0, 0 and the second at 50, 50. Also, the console.log($index) prints two 1's, instead of a 0 and a 1. Strange...
FamousFramework.component('m:test', {
behaviors: {
'.item': {
'$repeat': [0, 1],
'position': ($index) => {
console.log($index);
return [$index * 50, $index * 50]
},
'content': ($index) => {
return `<div style="width: 50px; height: 50px; background-color: yellow">${$index}</div>`
}
}
},
events: {},
states: {},
tree: `
<node class="item"></node>
`
});
EDIT: Hmm… just saw this seems to happen whenever the list you try to repeat over does not contain objects… So for example if you '$repeat’: [0, 1] it does not seem to create two elements, but if instead you '$repeat’: [{foo: ‘hello’}, {foo: ‘world'}] then it does create two elements…!
Metadata
Metadata
Assignees
Labels
No labels