FAQ Database Discussion Community

can-model cannot getting data from .json file

I am trying to implement MVC using AMD in canjs. For that I am using requirejs. This is my domains.json file: [ "1":{"uid": "1","urls": "domain1.abc.com"}, "2":{"uid": "2","urls": "domain2.abc.com"}, "3":{"uid": "3","urls": "domain3.abc.com"} ] This is my domainModel: define(['can'], function(can){ SearchModel= can.Model({ id: 'uid', findAll: 'GET /domains.json' },{}) return SearchModel; }) This...

Can.Model: creating model instances from plain objects

I have a can.Model with defined findOne, findAll methods. Sometimes however it is required to create model instances from plain objects, e.g. these objects are bootstrapped in html as globals during initial page load. The problem is that these instances are not merged with instances stored in can.Model.store object. Moreover...