Fluidbyte
Fluidbyte

Reputation: 5210

Changing 'url' property of Backbone Model and Collection

I'm writing a custom sync for Backbone and the name url for the sync isn't an obvious choice. I'd like to make it something like point so instead of:

MyAppModel = Backbone.Model.extend({
    url: '/some/api'
});

I can use...

MyAppModel = Backbone.Model.extend({
    point: 'some/reference`
});

Is there any way to (without modifying Backbone) make it so url = point?

Upvotes: 0

Views: 144

Answers (1)

Mosselman
Mosselman

Reputation: 1748

This should work: url = function(){return this.point };

But why do you want to 'rename' the url property? Just for semantics?

Upvotes: 2

Related Questions