Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top