I think your terminology is incorrect. For example, it is impossible to "inherit" from instances.
No where are you "dynamically" creating instances for the model. I'm not sure what "dynamically" means to you, but "creating instances OF the model" means you have code like:
- new BaseModel()
Also, using the word "Base" in "BaseModel" would strongly indicate to another developer that you are going to inherit from BaseModel. That code would look like:
- InheritedModel = BaseModel.extend({ ... }, {....})
Also, your syntax is incorrect. Control's are passed an object. Objects have propertiesNames and values. For instance:
- Feat =can.Control.extend({
- var that = this;
- can.view('images/js/mn/temps/header.ejs', Basemodel.findAll({with overriding parameters}).then(function(d) {
- return { userdata.userdata : d};
- })).done(function(frag)
- {
- that.element.html(frag);
- })
- that.display();
- }});
Should almost certainly look like:
- Feat =can.Control.extend({
- init: function(){
- var that = this;
- can.view('images/js/mn/temps/header.ejs', Basemodel.findAll({with overriding parameters}).then(function(d) {
- return { userdata.userdata : d};
- })).done(function(frag)
- {
- that.element.html(frag);
- })
- that.display();
- },
- display: function(){ ...}
- });
Notice how I put everything in an init function.
Make sure you use an IDE with JavaScript syntax highlighting.
Also, passing the URL is to findAll so it is used like:
- $.ajax({
- url: params.url ,
- dataType: 'json'})
- }
Is almost certainly something you should not be doing. The URLs are almost always hard-coded in a model layer. The reason is that you want something like a Person, Task, Location, that will have their own way of creating, reading, updating, and deleting data AND a host of other domain specific methods. You might want a .complete() method on your Task model, but that would make no sense on a Location model.
So please rewrite your question with valid code and correct terminology for things like:
- creating instances (ex: new Constructor(...) )
- extending or inheriting constructors (ex: Constructor.extend(...) )