Please describe your question here. Clone this JSBin to make examples.
Hi, I dont know how to use this._super() in controller is inherit its parent . who can give me some example?
I know it when learn it in https://canjs.com/docs/can.Construct.super.html . but i cann’t undertand it talk about?
Sorry about my stupid question!
You mentioned controllers, so I will assume you are referring to can.Control, with which you could do something like this:
var Parent = can.Control.extend({
init(el, opts) {
this.foo = 'bar';
}
});
var Child = Parent.extend({
init(el, opts) {
// call the parent to set `foo='bar'`
this._super(el, opts);
// more logic here
}
});
If you are using Components, the events
object will be used to create a control, but _super()
doesn’t really apply because you aren’t inheriting from another control (besides the internal ComponentControl).
If you are referring to a Component’s ViewModel as the controller, you can do the same type of thing with a Map constructor or any Construct.