Я знаю, что чаще всего это делается наоборот, но в моем конкретном случае мне нужна модель . PostsTimesсо ссылкой на Сборник (другой МоделиСообщение). Сейчас пытаюсь:
var Posts = Backbone.Collection.extend({
model: Post
});
var posts = new Posts(); // my collection
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});
Но this.posts
в PostsTimes
всегда остается undefined
. Есть ли способ сделать это без определения глобальной переменной?