Tuesday, 13 August 2013

Backbone.js - base path not concat with subpaths

Backbone.js - base path not concat with subpaths

In my base collection i have the base path, from the base path i am
extending further urls.. but while i console the url in the extended
collection i am not getting the full path of the url..
instead just i am getting the url - what the extended collection have..
why i am getting like so, and what should be the proper approach?
here is my try :
BaseCollection = Backbone.Collection.extend({
path: 'http://path/to/api'
});
TeachersCollection = BaseCollection.extend({
url:"xyz/abc",
initialize:function(){
console.log(this.url);//xyz/abc - why i am getting like this
instead of full path?
//full url should be 'http://path/to/api/xyz/abc' - how can i get
like this..?
}
});
var x = new TeachersCollection;
live demo

No comments:

Post a Comment