These are chat archives for canjs/canjs

Oct 2015
Mihai Fantana
Oct 19 2015 08:47
hi guys. canjs 2.2.9. in documentation it says that map/attributes are
supported until 3.0 at least.
still setup is done inconsistent. there should be a 4 parameter setup (including fullName of the Map/Model, my patched map/attributes right side of the picture), instead just a 3 parameter setup is called (left side of the picture)
can you please give me some more details on this? (others than should use define)
Matthew Phillips
Oct 19 2015 13:27
@meconcomputer looks like a probably bug, please send a PR
Alexis Abril
Oct 19 2015 17:06
What's the recommended approach for using subtemplates? {{> foo.stache}} isn't pre-compiled by steal in a production environment, iirc
Morgan Heimbeck
Oct 19 2015 17:08
We do can.view.preload before we instantiate the outer template.
function(OuterView, InnerView) {
can.view.preload(‘inner-template’, InnerView);
return can.component.extend({
tag: ’test-tag’,
template: OuterView
Alexis Abril
Oct 19 2015 17:43
@Xitstrategies Ah, good call
Matthew Phillips
Oct 19 2015 17:59
@alexisabril @Xitstrategies in 2.3 you can use can-import to import partials
there is a test for it... one sec
Oct 19 2015 18:57
I'm using Webstorm with the Handlebars plugin and noticed the new reference scope bindings are a bit of a problem because * is seen as invalid syntax in mustache (same with %). For example, {{myHelper *foo}} produces the error "Expected Close }}". Has anyone figured out a way around this or created a modified version of the plugin?
Gerard Finnerty
Oct 19 2015 19:36
Hi, ran into an odd bug, still investigating it, but I'm curious if anyone else experienced this... when using viewModel attrs for event bindings inside a component like events: { '{viewModel} errors.someField.showErrors': function(e, ev) {}} ...for some reason, if this event fires off more than a half dozen or so times, it just stops working, stops executing, no js errors... when i trace through, that attr still gets set (on field focus), but that function just stops executing... when I move the code from there into the field focus event, there is no issue
Justin Meyer
Oct 19 2015 21:42

@here - is there a way to prevent a can.Control from hooking up one of the templated event handlers? I have a "#fileInput change" that I want to prevent from being wired up if condition isn't met (in which case I will manually wire the event to a polyfill).

ryan [4:36 PM]
I will also take care to remove the manual binding during teardown - I just didn't know if setup allowed for that kind of thing.

there is not. I would not use a templated event binding and instead us .on() inside init.
Ryan Wheale
Oct 19 2015 21:45
ok, thanks for that.
Alexis Abril
Oct 19 2015 21:51
@DesignByOnyx if it's a common thing you're doing, you could also setup a custom processor. "#fileInput conditionalChange". You might need to address a syntax to pass conditions if those aren't set anywhere accessible(control options, element data, etc).
Ryan Wheale
Oct 19 2015 21:55
Thanks for that @alexisabril. Doing it during initialization (using .on) is working best as it's clearer what's going on (no pun intended). can is still taking care of managing the event binding in most cases... which is what I wanted.
Ryan Wheale
Oct 19 2015 22:18
So using .on() invokes handlers with an "event" parameter only - whereas CanJS templated event handlers get (element, event)parameters. This is actually convenient, but worthy of noting as the method signature has to be updated.
... when switching from templated to manual bindings.