These are chat archives for canjs/canjs

13th
May 2018
Dovid Bleier
@dbleier
May 13 2018 17:38
Hi, had a question on the best way to wire up a subcomponent inside a list
let's say I have a subcomponent criterion.component the has 3 props, field, operation, value
And the parent component has a DefineList, criteria to hold the subcomponents
Would the proper method be that the list holds a list of objects, {field:x, operation:y, value:z} and then in the stache to wire up each prop like <criterion field:bind="field" operation:bind="operation" value:bind="value" />
or
have a list of criterion.component viewModels, basically [new criterion.viewModel(), new criterion.viewModel()] and then in stache wire it up <criterion viewModel:bind="." />?
Seems like something like the latter would be better as there are less bindings to keep track of, but not sure it's possible like that or perhaps it's a really dumb way to do it.
thoughts?