cherifGsoul on update-infrastructure-page
Fix typos (compare)
cherifGsoul on document-inserted-removed-can6
Add inserted/removed events to … (compare)
greenkeeper[bot] on can-view-live-5.0.1
fix(package): update can-view-l… (compare)
greenkeeper[bot] on core-js-3.4.8
chore(package): update core-js … (compare)
cherifGsoul on update-infrastructure-page
Update infrastructure page with… (compare)
greenkeeper[bot] on @feathersjs
chore(package): update @feather… (compare)
greenkeeper[bot] on @feathersjs
chore(package): update @feather… (compare)
What’s everyone’s approach to abstracting out arbitrary data from a model?
For instance, suppose a user model:
{ id: 0, name: ‘Alexis’ }
However, in the template we would also want:
{ isEditing: false }
You wouldn’t want to add that attribute directly to the model as it has no benefit being sent back to the server(just view noise).
The elegant answer is inheritable defines(I think), but I’m curious what everyone’s approach has been thus far.
they would be on a viewmodel, just not the component’s necessarily. imagine you have a user model and your component has a user.list. user.isSelected could be some property you want to set.
In your view, you’d probably have something like:
{{#each users}}
<input type=“checkbox” can-value=“{isSelected}”/>
{{/each}}
isSelected
would be convenient at some lower level than the component viewmodel itself, but not necessarily all the way down to the model.