I know that this is most often done the other way around, but in my particular case I should have Model PostsTimes with reference to the assembly (another Post model ). Now I am trying:
var Posts = Backbone.Collection.extend({
model: Post
});
var posts = new Posts();
var PostsTimes = Backbone.Model.extend({
url: "api/times.php",
initialize: function(options){
this.posts = options.posts;
},
test: function(){
console.log(this.posts);
}
});
var poststimes = new PostsTimes({posts: posts});
But this.postsin PostsTimesalways undefined. Is there a way to do this without defining a global variable?
source
share