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

Re : Conventions, strategy, syntax, file extension for external mustache views/templates?

$
0
0
Matt, the data format is defined by your API, not the other way around. The only real expectation is that each object will have an id field, which toggles between create and update when invoking save. This too can be overridden, by setting the 'id' prop to your field name, as document here: http://canjs.com/docs/can.Model.id.html . This is especially use for something like mongodb, which stores it's object id as  '_id'.

If you have a non-standard api, you can override the model method, as decumented here: http://canjs.com/docs/can.Model.model.html

Setup your model with proper urls to your endpoints, then map those same urls out with can.fixture, pointing towards your sample json.


Viewing all articles
Browse latest Browse all 3491

Trending Articles