These are chat archives for canjs/canjs

27th
Oct 2017
Nico R.
@nriesco
Oct 27 2017 00:35
Thanks @chasenlehara that should work for me, I’ll try to adapt it t my code
Btw, any chance that validate could take advantage of simple validation provided by html?
Nico R.
@nriesco
Oct 27 2017 12:21

I have a doubt regarding the behaviour of {{#with .....}}
I thought it will check if the value existed but in my case it seems to fail, take a look a this example:

// this is the original code that sometimes fails (depending on the data - no checks)
<my-input-text-component currentData:bind="current.myObject.myProperty" />


// this works
{{#if current.myObject}}
  <my-input-text-component currentData:bind="current.myObject.myProperty" />
{{/if}}

But the think is that I would have expected this to work as well but didn't:

// this is what I thought should work (simple)
{{#with current}}
  {{#with myObject}}
  <my-input-text-component currentData:bind="myProperty" />
  {{/with}}
{{/with}}

Is this an intended behaviour? or is it a bug?
Thanks

BTW: the problem is when myObject is undefined (cannot get property myProperty of undefined)
Kevin Phillips
@phillipskevin
Oct 27 2017 13:20
you can use {{#current}} to do that
that will check if it exists and change the context
Nico R.
@nriesco
Oct 27 2017 13:23
but the second “with” is failing, maybe an issue with "double withs”?
Kevin Phillips
@phillipskevin
Oct 27 2017 13:25
same thing if you do this?
{{#current}}
  {{#myObject}}
  <my-input-text-component currentData:bind="myProperty" />
  {{/myObject}}
{{/current}}
Nico R.
@nriesco
Oct 27 2017 14:51
I moved in the past from {{#myObject}} to {{#with myObject}} because it was not working ok. If that was really a bug and is now fixed then that code should work. I don’t have the failing code at hand but I’ll let you know if it worked
Chasen Le Hara
@chasenlehara
Oct 27 2017 15:36
Watch our LIVE contributors meeting in just a few minutes! We’ll be giving demos of what we’ve been working on. https://www.youtube.com/watch?v=ns8mkQFFGEo