viewmodel
viewmodel copied to clipboard
Strange behavior on properties.
I'll just paste the self-explained code below: P.S. I tried setting a new value instead of using reset(), same strange behavior.
Template.cartItem.viewmodel
shippingPrice: undefined
updateShippingPrice: ->
if @ship() and not @outOfStock()
Meteor.call 'calculateShipingPrice', @productId(), (error, result) =>
if error
FF.helpers.showInternalError error
else
@shippingPrice result
else
@shippingPrice.reset()
@shippingPrice() # FIXME: Why doesn't work without this line?
# shippingPrice doesn't update if I don't ask for it's value now
I don't understand the problem. Please make a minimal repro, preferably without Meteor calls and anything not germane to the problem.
Thanks.
On Sep 2, 2016 1:22 PM, "Tomas Hayes" [email protected] wrote:
I'll just paste the self-explained code below: P.S. I tried setting a new value instead of using reset(), same strange behavior.
Template.cartItem.viewmodel shippingPrice: undefined updateShippingPrice: -> if @ship() and not @outOfStock() Meteor.call 'calculateShipingPrice', @productId(), (error, result) => if error FF.helpers.showInternalError error else @shippingPrice result else @shippingPrice.reset() @shippingPrice() # FIXME: Why doesn't work without this line? # shippingPrice doesn't update if I don't ask for it's value now
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ManuelDeLeon/viewmodel/issues/271, or mute the thread https://github.com/notifications/unsubscribe-auth/AED31qdnOFh1-bR_GTcvYsF1QGpVni3Lks5qmHU-gaJpZM4J0AZu .