These are chat archives for canjs/canjs

28th
Jan 2016
dylanrtt
@dylanrtt
Jan 28 2016 02:28
@dbleier modules are singletons, but they are frequently used to return constructor functions. Just have your module return an object or can.Map instance
has them marked as deprecated. But yes, those other sections should be removed
please create an issue
Jeroen Cornelissen
@jeroencornelissen
Jan 28 2016 13:34

I need some help with a problem. See this jsbin: http://jsbin.com/paxisi/16/edit?html,js,output
If you click "Tab 1" it has 2 subtitles and if you click "Another tab" it should only have 1 subtitle but the second subtitle from Tab 1 stays.
Inside the useradapt-nav component (NavViewModel), I have a function that sets the activeForm.

setActivePage : function(el, activeForm) {
    activeForm.attr(el.data('formModel').attr());
  }

Any thoughts?

Mohamed Cherif Bouchelaghem
@cherifGsoul
Jan 28 2016 14:33
@jeroencornelissen do you have a simplified version of your script?
Jeroen Cornelissen
@jeroencornelissen
Jan 28 2016 14:42
no, i don't
@cherifGsoul I already simplified it :worried:
Matthew Phillips
@matthewp
Jan 28 2016 15:16
@dbleier what @dylanrtt said is what I was thinking
Dovid Bleier
@dbleier
Jan 28 2016 15:17
@matthewp , @dylanrtt ok, cool. I'll try that route. thanks!
Guido Smeets
@gsmeets
Jan 28 2016 15:25
@jeroencornelissen my guess is it goes haywire because you're binding to the same activeForm property twice on both the models
Jeroen Cornelissen
@jeroencornelissen
Jan 28 2016 15:31
@gsmeets How else would you pass an Observable to two or more components?
Guido Smeets
@gsmeets
Jan 28 2016 15:39
hmm no, that wasn't the problem
Curtis Cummings
@ccummings
Jan 28 2016 16:26
@jeroencornelissen You need to pass true as the second parameter to your .attr call in setActivePage.
activeForm.attr(el.data('formModel').attr(), true);
Jeroen Cornelissen
@jeroencornelissen
Jan 28 2016 19:53
@ccummings Nice one, thanks! Never had to use that before.