2

I am using Canjs to build my Web application . Now i have a issue while i am working on it.

The controllers get changed on a Single HTML element and the controllers that got attached to that particular element does not get destroyed when the new controller gets attached. So i decided to destroy all the controllers attached to that before I attach something else to it.

I am left with two queries

  1. How do i find the attached controllers on a particular element ? as .controller() doesn't work

  2. How do i call the destroy?

Please help me Thanks in Advance .

ramblinjan
  • 6,578
  • 3
  • 30
  • 38

1 Answers1

1

If you are using the can.Control.plugin plugin it should be possible to access all the controls on an element by calling $(element).controls().

Daff
  • 43,734
  • 9
  • 106
  • 120
  • but how do i extract the constructor name? –  Oct 22 '12 at 10:35
  • What do you mean? Depends on how you initialize it. `var Construct = can.Construct({}, {})` it doesn't have a name. If you are creating it with `can.Construct(`My.Name`, {}, {})` the `instance.constructor.fullName` property will be `My.Name`. – Daff Oct 22 '12 at 15:21
  • @Daff: $(element).controls() is not working for me. what would be the reasons for happening this? – Dipesh Raichana Jul 09 '15 at 04:38