These are chat archives for canjs/canjs

17th
Jul 2015
avg6003
@avg6003
Jul 17 2015 04:16

@justinbmeyer Actually I am using a css class on which I am changing my template using route. Now on the same page when I am switching the template the previuos controller is effecting on my latest temaplte which I have loaded and it is also affected by its own controller too as I have added other controller on the same class. Here is my code.

`define(['can', 'jquery', 'models/DomainModel', 'controllers/FormHeader'], function(can, $, DomainModel, FormHeader) {
'use strict';
var DomainController = can.Control.extend({
defaults: {
view: 'views/domainSearch.hbs'
}
},{
init: function(element, options) {
new FormHeader('#header');
},
'input keyup': function() { ... }
});
return DomainController;
});

I have other login controller but I am calling bothe of them on new LoginController('.main-container');' andnew DomainController('.main-container')`

So when I start to type in login.hbs template the input keyup event automatically getting fired
which is defined in domaincontroller
avg6003
@avg6003
Jul 17 2015 04:21
so what should be the solution? Should I use can.Map or can.component?
Patrick Clancy
@patrickclancy
Jul 17 2015 12:58
@justinbmeyer Thanks for the help. When I first looked at the jsbin I almost didn’t catch your syntax change to the can.vew. Here it is for anyone looking for this solution.
can.view("app2")({ dfd: defObj });