cherifGsoul on update-api-page
cherifGsoul on master
Update API page (#5432) * Upda… (compare)
greenkeeper[bot] on core-js-3.5.0
chore(package): update core-js … (compare)
greenkeeper[bot] on can-observable-mixin-1.0.7
fix(package): update can-observ… (compare)
cherifGsoul on update-infrastructure-page
cherifGsoul on master
Update infrastructure page with… (compare)
cherifGsoul on update-infrastructure-page
Fix typos (compare)
computeA.value
seems to work.
var ChildVM = can.Map.extend({
define: {
myComputed: {
get: function(){ return 'foo';}
}
}
});
can.Component.extend({
tag: 'my-child',
viewmodel: ChildVM
});
can.Component.extend({
tag: 'my-parent',
template: can.stache('<my-child myComputed="{getComputed}"></my-child>')
viewmodel: {
getComputed: null
}
});
can.Map
’s with { type: ‘compute’ }
. It’s just not documented yet: bitovi/canjs#1690
can.Map.define
. A compute takes a property on set… compute(newVal)
. So if you unknowingly attempted to set list
to something else, like.. map.attr(‘list’, someOtherList)
, you’ll actually be passing someOtherList
to the compute, like this.. map.list(someOtherList)
, as opposed to map.list = someOtherList
. Does that make sense?
get
is meant to describe a value that is made up of other values. And since that value is dependent on other values, the get
function will only be evaluated when one of those dependent values are changed. In other words, map.attr(‘list’)
won’t call get
because none of its dependent values have changed. However, when you pass a value to the can.compute
like this.. map.attr(‘computedProp’, anotherList)
the compute re-evaluates due to the new lastSetVal
.
this.scope.dimensionList()
. That’s the incorrect way to read the value. What you should do instead is this.scope.attr(‘dimensionList’)
.
searchTermChanged: function(el, ev){
var searchTerm = el.val();
this.scope.attr('searchTerm', searchTerm);
},