The syntax is this.options.field
, any default property can be accessed with this.options.defaultProperty
.
Defaults in CanJS controller constructor
-
05-07-2022 - |
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?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow