These are chat archives for canjs/canjs

13th
Dec 2017
Gregg Roemhildt
@roemhildtg
Dec 13 2017 13:50
Hey guys, here's an awesome demo of integrating canjs with the arcgis api! https://roemhildtg.github.io/can-arcgis/index-prod.html#!edit-features
Shout out to yall for all the help in getting this working
Chasen Le Hara
@chasenlehara
Dec 13 2017 15:27
Awesome, thanks for sharing @roemhildtg!
Gregg Roemhildt
@roemhildtg
Dec 13 2017 16:40
:smile: no prob. Open to feedback also, positive or negative!
This is what makes it possible to bind to the api's "Accessor" object in stache templates
Gregg Roemhildt
@roemhildtg
Dec 13 2017 17:19
negativeconstructive :)
Gregg Roemhildt
@roemhildtg
Dec 13 2017 20:11
Can stache bind on an objects child properties?
<my-component prop.a:to="scope.aProp" /> A is: {{scope.aProp}}
Kevin Phillips
@phillipskevin
Dec 13 2017 20:24
yes
you can do that
Gregg Roemhildt
@roemhildtg
Dec 13 2017 20:27
Okay. Wasn't sure if it would work with periods. What's confusing is vm:prop:a. Is that the same as vm.prop.a?
Kevin Phillips
@phillipskevin
Dec 13 2017 20:31
no, it's not
vm: tells it to explicitly bind to the viewModel
as opposed to binding to an event on the element
Gregg Roemhildt
@roemhildtg
Dec 13 2017 20:42

Gotcha. Okay. So this is what I'm doing:

<component prop.name.a:bind="scope.vars.a" />

In this case, the Component ViewModel looks like this:
{
    prop: {
        name: { a: 100 }
    }
}
And if I put {{scope.vars.a}} in the template, it shows the correct value. But if I look at the ViewModel after changing scope.vars.a, a new property seems to get set on the viewmodel. Like its setting a new property called ViewModel['prop.name.a']
Kevin Phillips
@phillipskevin
Dec 13 2017 20:46
can you test with just one . level? like prop.a:bind="scope.vars.a"
Gregg Roemhildt
@roemhildtg
Dec 13 2017 20:59
Okay. It happens with one level too. I think its possibly a bug. https://jsbin.com/furiquqepo/1/edit?html,js,output
check the console
If I update one textbox, it updates the other, but the second textbox doesn't update the first
Instead it sets a new property on the Component ViewModel
Gregg Roemhildt
@roemhildtg
Dec 13 2017 21:11
I created an issue. canjs/can-stache#408
If I'm doing something wrong let me know
Kevin Phillips
@phillipskevin
Dec 13 2017 21:11
thanks
will take a look