Backbone.RelationalModel using requireJs

I would like to use RelationalModel using requireJs .

Here is my code (*)

When I start my module, I get the following warning message:

 Relation=d; no model, key or relatedModel (function (){a.apply(this,arguments)}, "tasks", undefined). 

My questions:

1) what does warning mean?
2) relatedModel and collectionType clearly defined in my relations or do I need to export the model and collection call to define ?


(*)

 define([ 'backbone', 'relationalModel' ], function (Backbone) { "use strict"; var User = Backbone.RelationalModel.extend({ relations: [{ type: Backbone.HasMany, key: 'tasks', relatedModel: 'Task', collectionType: 'TaskCollection', reverseRelation: { key: 'hasUser', includeInJSON: 'id' // 'relatedModel' is automatically set to 'User'; the 'relationType' to 'HasOne'. } }] }); return User; }); 
0
source share
1 answer

Have a look at this question: Creating nested models with backboneJS + backbone-relational + requireJS

By the way, exports.ModuleModel = ModuleModel; not working for me. Instead, I use window.ModuleModel = ModuleModel . Yes, it's a little ugly, but it works.

+1
source

All Articles