I have a Backbone Collection
class with the url
property set to a method.
The url
is comprised of 3 "elements" which I have called baseUrl
, username
and path
- so it would look something like baseUrl/username/path
I use the same instance for several users in the spa I am working on. However the one element I want to be able to change (after instantiation) is the username. I need this for 2 reasons.
1st - I don't have the username property at instantiation time.
2nd - The username changes depending on the user and I don't want to create new instances of the collection for every new user.
So my issue is why does the url
method not take parameters after instantiating the collection so that I could do something like myCollection.url({username: "Mac"})
?
Also why does Backbone
not allow for parameters to be passed into the url
method?