Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Commit

Permalink
Docs updates
Browse files Browse the repository at this point in the history
  • Loading branch information
davideast committed Nov 24, 2014
1 parent 3ac3da7 commit 80cb2eb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Play around with our [realtime Todo App demo](https://backbonefire.firebaseapp.c
## Basic Usage
Using BackboneFire collections and models is very similar to the regular ones in Backbone. To setup with BackboneFire use `Backbone.Firebase` rather than just `Backbone`.

**Note: A `Backbone.Firebase.Model` should not be used with a `Backbone.Firebase.Collection`. Use a regular
`Backbone.Model` with a `Backbone.Firebase.Collection`.**

```javascript
// This is a plain old Backbone Model
var Todo = Backbone.Model.extend({
Expand Down Expand Up @@ -139,6 +142,17 @@ var TodoList = Backbone.Firebase.Collection.extend({

### url as a function

The `url` property can be set with a function. This function must return a Firebase ref or a url.

```javascript
var TodoList = Backbone.Firebase.Collection.extend({
url: function() {
return new Firebase(...);
}
});
```


### initialize function

Any models added to the collection will be synchronized to the provided Firebase. Any other clients
Expand Down Expand Up @@ -213,8 +227,9 @@ var Todo = Backbone.Firebase.Model.extend({
You may apply query methods as with `Backbone.Firebase.Collection`.

### urlRoot
```javascript
The `urlRoot` property can be used to dynamically set the Firebase reference from the model's id.

```javascript
var Todo = Backbone.Firebase.Model.extend({
urlRoot: 'https://<your-firebase>.firebaseio.com/todos'
});
Expand Down

0 comments on commit 80cb2eb

Please sign in to comment.