var Gallery = Backbone.Controller.extend({
_index: null,
_photos: null,
_album :null,
_subalbums:null,
_subphotos:null,
_data:null,
_photosview:null,
_currentsub:null,
routes: {
"": "index",
"subalbum/:id": "subindex",
"subalbum/:id/" : "directphoto",
"subalbum/:id/:num" : "hashphoto"
},
initialize: function(options) {
var ws = this;
if (this._index === null){
$.ajax({
url: 'data/album1.json',
dataType: 'json',
data: {},
success: function(data) {
ws._data = data;
ws._photos =
new PhotoCollection(data);
ws._index =
new IndexView({model: ws._photos});
Backbone.history.loadUrl();
}
});
return this;
}
return this;
},
//Handle rendering the initial view for the
//application
index: function() {
this._index.render();
},
আমি এখানে backbone.js এর একটি টিউটোরিয়াল পড়ছি: http://addyosmani.com/blog/building-spas-jquerys-best-friends/
আন্ডারস্কোরগুলি কী কী? (_আইডেক্স, _ফোটস, _্যালবাম) এগুলি কেন ব্যবহার করবেন?