These are chat archives for canjs/canjs

30th
Apr 2017
Eben
@eben-roux
Apr 30 2017 19:15
Good evening (from South Africa)...
Is there a way to pass the result from a helper to a component?
Nico R.
@nriesco
Apr 30 2017 20:18
You can use bindings
And let the helper modify it
And as the helper would probably be inside of a component then you should bind two components
Eben
@eben-roux
Apr 30 2017 20:20
So I have this button in a table component: <sentinel-remove-button {context}="getButtonContext(../., .)" ...
Currently it seems as though the getButtonContext is handled as a key expression and it obviously does not exist on the model
How would I go about using your technique?
perhaps...
{{setButtonContext(../., .)}} just before the sentinel-remove-button?
Eben
@eben-roux
Apr 30 2017 20:32
@nriesco : Excellent... that seems to have done the trick. Quite sneaky, thanks :)
Nico R.
@nriesco
Apr 30 2017 20:32
cool!
Brad Momberger
@bmomberger-bitovi
Apr 30 2017 20:58
If you're seeing the result of that call expression interpreted as a key lookup, that may be a bug in the stache parsers. Can you isolate it in a JSBin?
Eben
@eben-roux
Apr 30 2017 21:00
@bmomberger-bitovi : No, it wasn't that. I was slightly confused as to why my helper wasn't being invoked but I then assumed that when binding the component attributes they bind to key expressions and not to the helper output. Is my assumption correct?
Brad Momberger
@bmomberger-bitovi
Apr 30 2017 21:03
I see what you're saying, I think. Tell me if this is what you have in mind: getButtonContext here becomes a scope lookup in the binding expression (to find the function to call for the Call expression), but scope lookups here aren't including anything in helpers on the parent component. So if you put the function on the ViewModel instead, it would be found?