Defaults in CanJS controller constructor

216 views Asked by At

I have a controller that is similar to:

var TheController = can.Control.extend({
    defaults: {
    field: undefined
},

"pluginName": "theControllerPlugin",
},
{
"init" : function(element, options) {
    field = options["fieldInOptions"];

Right now this field is acting essentially as a static variable. I would prefer it acted as an instance variable. Is this possible and what is the syntax in canJS?

1

There are 1 answers

0
Cherif BOUCHELAGHEM On BEST ANSWER

The syntax is this.options.field, any default property can be accessed with this.options.defaultProperty.