These are chat archives for canjs/canjs

14th
Aug 2018
Justin Meyer
@justinbmeyer
Aug 14 2018 16:49

I guess I am now a canjs contributor :smile:

YAY!

Matthew Phillips
@matthewp
Aug 14 2018 17:26
Any idea why {{#each(items)}} {{.}} {{/each}} would be the parent context, not the item within the each?
Viktor Busko
@Lighttree
Aug 14 2018 17:29

Hi guys, is it possible to bind helper evaluation to VM property in canjs 3 without warnings ?

https://codepen.io/Lighttree/pen/KBYJaE?editors=1010

In this example I'm doing this witch canjs5, but in 3 such syntax doesnt work at all.
I've tried just helper expression like:

<test-sandbox something:from="{{testhelper}}"></test-sandbox>

And it inserts correct value, but throwing warning: Unable to find key or helper "testhelper".

Viktor Busko
@Lighttree
Aug 14 2018 17:37
Ah...no its just visible in DOM, but it doesn't actually pass it to component
Ok I found the reason :)
<test-sandbox something:from="'{{testhelper}}'"></test-sandbox> works
because it should be passed as string.
Justin Meyer
@justinbmeyer
Aug 14 2018 18:19
@matthewp possibly a bug.
@Lighttree what are you trying to do?
I'm confused why you are putting {{}} inside a stache-binding
I don't see a warning in that codepen
<test-sandbox something:from="testhelper()"></test-sandbox> is what I see in the codepen, and that does work. Maybe you figured it out.
Nico R.
@nriesco
Aug 14 2018 20:19

Any idea why {{#each(items)}} {{.}} {{/each}} would be the parent context, not the item within the each?

@matthewp although as @justinbmeyer said, it might be a bug, this might help: I use can 3 and I had warnings before when doing {{#each(items)}} {{property1}} {{/each}} and instead I had to explicitly use {{#each(items)}} {{./property1}} {{/each}}. There might be a relation, I use multiple "levels" and most of them share property names (name, _id, createdAt, you name it..) so my guess is that somehow if the variable is in the parent scope it can create some sort of confusion.

I cannot promise an example of this error/warning but if I'm able to reproduce it I'll post it.

Kevin Phillips
@phillipskevin
Aug 14 2018 20:37
this must be a bug
what was items in your example @matthewp ?
Matthew Phillips
@matthewp
Aug 14 2018 20:55
Thanks or the help everyone!
There were other issues with the stache file that I think were causing this problem.