You might want to consider using more template driven techniques here. You can either make a helper function that'll initialize your controller when an element is inserted, and make the entire block conditional, or you could take the leap to using can.Component (highly recommended).
↧