I am getting this unexpected behavior of loading meta information with a CompositeView with MarionetteJS. The JSON from server-side looks like:
{ "meta": { "total": 2 }, "movies": [ { "category": "Action", "description": "Another story goes ....", "id": 1, "stars": "4.0", "title": "My test movie" }, { "category": "Action", "description": "the story goes....", "id": 2, "stars": null, "title": "my second movie" } ] }
I use a Backbone collection to set the meta information like:
MA.Collections.Movies = Backbone.Collection.extend({ url: '/api/movies.json', parse: function(data) { this.meta = new MA.Models.MetaMovie(data.meta); return data.movies; } }); MA.addInitializer(function() { MA.Collections.Movies.model = MA.Models.Movie; })
But when I try to access this meta variable from the CompositeView, the collection is initialized properly, while the meta information seems to be lost. Any ideas how to provide this meta information to the model of a CompositeView?
PS The console output looks like: