These are chat archives for canjs/canjs

5th
Jul 2016
Justin Meyer
@justinbmeyer
Jul 05 2016 00:33
@web-mech its undefined if the property isn't bound
Async getters need to be bound before being read. This is for memory safety.
Michael Price
@web-mech
Jul 05 2016 12:22
@justinbmeyer thanks for the insight
Guido Smeets
@gsmeets
Jul 05 2016 13:42
@justinbmeyer I'm wondering how much effort it'll take to migrate to 3.0 eventually
I'm afraid I'll be having quite a few blocking factors
(still in the process of upgrading all the pre 2.3 bindings to 2.3 syntax)
Christopher Oliphant
@RALifeCoach
Jul 05 2016 14:05
Hello all, I am having a puzling problem. I am creating a component within a component. I am binding properties. Most properties are one way binding adult to child.
I have one property that I want to be two way binding.
Here is the stache snippet with one way binding.
            <player-row id="player-row-{{player.player_id}}"
                        {highlight}="highlight"
                        {is-my-lb}="false"
                        {options}="options"
                        {parent}="parent"
                        {player}="player"
                        {favourites-count}="favouritesCount"
            ></player-row>
Here is the same stache snippet with the one property with two way binding
            <player-row id="player-row-{{player.player_id}}"
                        {highlight}="highlight"
                        {is-my-lb}="false"
                        {options}="options"
                        {parent}="parent"
                        {player}="player"
                        {{favourites-count}}="favouritesCount"
            ></player-row>
Michael Price
@web-mech
Jul 05 2016 14:07
 <player-row id="player-row-{{player.player_id}}"
                        {highlight}="highlight"
                        {is-my-lb}="false"
                        {options}="options"
                        {parent}="parent"
                        {player}="player"
                        {(favourites-count)}="favouritesCount"
            ></player-row>
also be wary of binding primitives, since they are passed by value and not reference
Christopher Oliphant
@RALifeCoach
Jul 05 2016 14:08

When I use the second snippet, in my viewModel when I get the player property, I actually get the favourites-count value.

var player = this.attr('player’);

returns 0 (the value in favouritesCount), not the player object.

Michael Price
@web-mech
Jul 05 2016 14:08
you would want to bind an object instead of a primitive
Christopher Oliphant
@RALifeCoach
Jul 05 2016 14:09
@web-mech let me try that
Christopher Oliphant
@RALifeCoach
Jul 05 2016 14:28
@web-mech that didn’t work. The player property contains the favouritesCount object.
When I do not use two way binding on favouritesCount, then the player object is correct.
Michael Price
@web-mech
Jul 05 2016 14:30
thats interesting to say the least. maybe make a jsbin illustrating the problem?
sometimes that also helps isolate the issue
Christopher Oliphant
@RALifeCoach
Jul 05 2016 14:31
I was just about to write you and say I found the problem. Two way binding is {(xxx)} I had {{xxx}}.
My error - as usual
Michael Price
@web-mech
Jul 05 2016 14:33
no worries, i was trying to point that out in the snippet i posted but i guess i could have explained that bit
qantourisc
@qantourisc
Jul 05 2016 17:52
What would be the best way to pass obj-bases data into a stache helper ? {{helper obj}} ? or {{helper compute}} ?
Jeremy Miller
@jjm340
Jul 05 2016 20:08
What's the best way to resolve paths in donejs/canjs in terms of images etc?