Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : parseModel and arrays

$
0
0
Using the define plugin from Map allows you to specify a type of any attribute of the model.  By specifying a type  of "*" for the array attribute, it will prevent the default type conversion of arrays into can.Lists or objects into can.Maps.  You just need to add the define attribute to the instance/prototype section of your model.

define: {
my_stuff_list: {type: "*"},
my_info: {type: "*"}
},
Assuming my_stuff_list is an array and my_info is an object, this will ensure that when the model object is created, they will be created as javascript array and object.


Viewing all articles
Browse latest Browse all 3491

Trending Articles