Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 18 22:20
    greenkeeper[bot] labeled #5391
  • Oct 18 22:20
    greenkeeper[bot] opened #5391
  • Oct 18 22:20

    greenkeeper[bot] on can-observable-mixin-1.0.3

    fix(package): update can-observ… (compare)

  • Oct 18 19:08
    cherifGsoul labeled #5390
  • Oct 18 19:07
    cherifGsoul opened #5390
  • Oct 18 18:45
    greenkeeper[bot] labeled #5389
  • Oct 18 18:45
    greenkeeper[bot] opened #5389
  • Oct 18 18:45

    greenkeeper[bot] on can-observable-bindings-1.3.0

    fix(package): update can-observ… (compare)

  • Oct 18 18:29

    matthewp on master

    Update dist for release (compare)

  • Oct 18 18:29

    matthewp on v6.1.3

    Update dist for release 6.1.3 (compare)

  • Oct 18 17:59

    matthewp on can-observable-array-1.0.2

    (compare)

  • Oct 18 17:59

    matthewp on master

    fix(package): update can-observ… Merge pull request #5388 from c… (compare)

  • Oct 18 17:59
    matthewp closed #5388
  • Oct 18 16:46
    greenkeeper[bot] labeled #5388
  • Oct 18 16:46
    greenkeeper[bot] opened #5388
  • Oct 18 16:46

    greenkeeper[bot] on can-observable-array-1.0.2

    fix(package): update can-observ… (compare)

  • Oct 18 12:45
    greenkeeper[bot] labeled #5387
  • Oct 18 12:45
    greenkeeper[bot] opened #5387
  • Oct 18 12:45

    greenkeeper[bot] on can-stache-element-1.0.2

    fix(package): update can-stache… (compare)

  • Oct 18 09:49
    chasenlehara edited #5384
Brad Momberger
@bmomberger-bitovi
OK, so when you want to define a property on a DefineMap as being a DefineMap with its own known properties, then you need to use the type specifier (or Type), rather than directly giving it property values.
So your selection property will look like this:
 "selection": {
     "type": {
          'name': { 'value': null },
          'associated_IDs': { 'Value': DefineList },
          get common_associated_IDs() {
            return this.name;
          }
        } 
    }
You can tweak the type and value and getter/setters for each sub-property as needed. They work the same as the containing object, so value is necessary for initial values
If you want the selection to also be initialized, you can then initialize it with value: {}along with the type def.
Mohamed Cherif Bouchelaghem
@cherifGsoul
@phillipskevin it's fine now
Gira Minus
@gKreator
@phillipskevin Hey how come this is not working? http://jsbin.com/dibiqut/edit?js,console,output
Gira Minus
@gKreator
i tried quite a few things :/
Jeroen Cornelissen
@jeroencornelissen
@gKreator try something like:
post: {
    Type: Post,
    get: function(){
      return {
        id: 123,
        userId: 1,
        title: 'test',
        body: 'testing'
      };
    }
  },
Gregg Roemhildt
@roemhildtg
Gira Minus
@gKreator
what if the get value had an ajax call in it?
Gregg Roemhildt
@roemhildtg
Use an async getter
Kevin Phillips
@phillipskevin
not sure exactly what you want it to do, but it’s erroring because post is undefined
which you can fix with an {{#if post}}
Gira Minus
@gKreator
i was going to create a can-connect that on page load it gets the post_id, then sends an ajax request and fills itself out
i think i saw something similar on bitballs
Gira Minus
@gKreator
@phillipskevin this is a more complete example http://jsbin.com/dibiqut/edit?js,console,output
blob
that worked
nice
thanks @phillipskevin it was that {{#if post}} that was needed
Kevin Phillips
@phillipskevin
:thumbsup:
Gira Minus
@gKreator
does {($value)}="item.name" can-stache-converters work right out of the box or do you have to import and assign something?
Brad Momberger
@bmomberger-bitovi
That's part of can-stache-bindings
Gira Minus
@gKreator
import "can-stache-converters";
is that all you have to do?
ohh bindings
Brad Momberger
@bmomberger-bitovi
Should be, yeah, and with converters you get things like {($value)}="equal(~val, 'foo')"
(can-stache-converters itself imports can-stache-bindings, since the two work together)
Gira Minus
@gKreator
seems to not be working
Brad Momberger
@bmomberger-bitovi
Any console errors with that?
Gira Minus
@gKreator
nope
Brad Momberger
@bmomberger-bitovi
Hm.
Can you repro this in a JSBin?
Gira Minus
@gKreator
it works in a jsbin
Brad Momberger
@bmomberger-bitovi
OK.
Gira Minus
@gKreator
im using steal and such on the actual app, so just wondering if i have to import anything special
Brad Momberger
@bmomberger-bitovi
You can try importing can-stache-bindings directly, but I think your issue might be elsewhere, like if you're creating a context around the place where you're doing this binding (like, if you made a stache section)
Gira Minus
@gKreator
omg
it only works if the value is a number
wtf
Brad Momberger
@bmomberger-bitovi
Your viewmodel is a DefineMap?
Gira Minus
@gKreator
and it does not update the map
yes
Brad Momberger
@bmomberger-bitovi
I had a similar problem recently that made a property undefined all the time, and it was due to a separate definition setter happening that blanked out the value. I don't know if that's your issue, but maybe try commenting out your other defined values
Gira Minus
@gKreator
just noticed something crazy
nested properties are bleeding into the parent object of my definemap
Brad Momberger
@bmomberger-bitovi
a-ha. That is crazy
Gira Minus
@gKreator
blob