Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds API reference #754

Merged
merged 11 commits into from
Jun 3, 2016
Merged
10 changes: 5 additions & 5 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Thank you for contributing to the Firebase community!
We get lots of those and we love helping you, but GitHub is not the best place for them. Issues
which just ask about usage will be closed. Here are some resources to get help:

- Start with the [quickstart](../docs/quickstart.md)
- Go through the [guide](../docs/guide/README.md)
- Read the full [API reference](https://angularfire.firebaseapp.com/api.html)
- Try out some [examples](../README.md#examples)
- Start with the [quickstart](/docs/quickstart.md)
- Go through the [guide](/docs/guide/README.md)
- Read the full [API reference](/docs/reference.md)
- Try out some [examples](/README.md#examples)

If the official documentation doesn't help, try asking a question on the
[AngularFire Google Group](https://groups.google.com/forum/#!forum/firebase-angular) or one of our
Expand Down Expand Up @@ -93,7 +93,7 @@ $ grunt install # install Selenium server for end-to-end tests
$ export ANGULARFIRE_TEST_DB_URL="https://<YOUR-DATABASE-NAME>.firebaseio.com"
```

3. Update the entire `config` variable in [`tests/initialize.js`](../tests/initialize.js) to
3. Update the entire `config` variable in [`tests/initialize.js`](/tests/initialize.js) to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This link can't be right? Should be tests/initialize.js in both places?

correspond to your Firebase project. You can find your `apiKey` and `databaseUrl` by clicking the
**Web Setup** button at `https://console.firebase.google.com/project/<projectId>/authentication/users`.

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ will be closed. Here are some resources to get help:

- Start with the quickstart: https://github.com/firebase/angularfire/blob/master/docs/quickstart.md
- Go through the guide: https://github.com/firebase/angularfire/blob/master/docs/guide/README.md
- Read the full API reference: https://angularfire.firebaseapp.com/api.html
- Read the full API reference: https://github.com/firebase/angularfire/blob/master/docs/reference.md
- Try out some examples: https://github.com/firebase/angularfire/blob/master/README.md#examples

If the official documentation doesn't help, try asking through our official support channels:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ $ bower install angularfire --save

* [Quickstart](docs/quickstart.md)
* [Guide](docs/guide/README.md)
* [API Reference](https://angularfire.firebaseapp.com/api.html)
* [API Reference](docs/reference.md)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The /s work fine though, check out this file and try the reference link :)

In that case, is this one incorrect? Shouldn't it also begin with a /? Sigh, I feel like a GitHub noob suddenly. I didn't know I was so poorly versed in how URLs work.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this page is at the root of the repo, so you don't need the leading /. It's just like doing require() in Node. Relative paths are relative to the current file and absolute paths are relative to the root of the repo.



## Examples
Expand Down
9 changes: 2 additions & 7 deletions docs/guide/beyond-angularfire.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ in mind:
* **Use `$window.Firebase`**: This allows test units and end-to-end
tests to spy on the Firebase client library and replace it with mock functions. It also avoids the linter warnings about
globals.
* **Mock Firebase for testing**: Use mocks for unit tests. A non-supported,
third-party mock of the Firebase classes can be
[found here](https://github.com/katowulf/mockfirebase). The
[AngularFire unit tests](https://github.com/firebase/angularfire/blob/master/tests/unit)
can be used as an example of mocking `Firebase` classes.


## Deploying Your App
Expand All @@ -77,10 +72,10 @@ or you can host it at any custom domain on one of our paid plans. Check out

There are many additional resources for learning about using Firebase with Angular applications:

* Browse the [AngularFire API documentation](https://angularfire.firebaseapp.com/api.html).
* Browse the [AngularFire API reference](/docs/reference.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, think the leading / is incorrect?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct - we've doubled checked all these links, Github is smart enough to handle the repo-specific /

* The [`angularfire-seed`](https://github.com/firebase/angularfire-seed) repo contains a template
project to help you get started.
* Check out the [various examples that use AngularFire](../README.md).
* Check out the [various examples that use AngularFire](/README.md#examples).
* Join our [AngularFire mailing list](https://groups.google.com/forum/#!forum/firebase-angular) to
keep up to date with any announcements and learn from the AngularFire community.
* The [`angularfire` tag on Stack Overflow](http://stackoverflow.com/questions/tagged/angularfire)
Expand Down
8 changes: 4 additions & 4 deletions docs/guide/extending-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ set when `$$added` is invoked.
remote value at a path is `"foo"`, and that path is synchronized into a local `$firebaseObject`,
the locally synchronized object will have a JSON structure `{ "$value": "foo" }`. Similarly, if a
remote path does not exist, the local object would have the JSON structure `{ "$value": null }`.
See [Working with Primitives](../guide/synchronized-object.md#working-with-primitives) for more details.
See [Working with Primitives](./synchronized-objects.md#working-with-primitives) for more details.

By default, data stored on a synchronized object or a record in a synchronized array exists
as a direct attribute of the object. We denote any methods or data which should *not* be
Expand Down Expand Up @@ -86,7 +86,7 @@ The `new` operator is required for child classes created with the `$extend()` me
The following special `$$` methods are used by the `$firebaseObject` service
to notify itself of any server changes. They can be overridden to transform how data is stored
locally, and what is returned to the server. Read more about them in the
[API documentation](https://angularfire.firebaseapp.com/api.html#extending-the-services).
[API documentation](/docs/reference.md#extending-the-services).

| Method | Description |
|--------|-------------|
Expand Down Expand Up @@ -134,7 +134,7 @@ The `new` operator is required for child classes created with the `$extend()` me
The following special `$$` methods are called internally whenever AngularFire receives a notification
of a server-side change. They can be overridden to transform how data is stored
locally, and what is returned to the server. Read more about them in the
[API documentation](https://angularfire.firebaseapp.com/api.html#extending-the-services).
[API documentation](/docs/reference.md#extending-the-services).

| Method | Description |
|--------|-------------|
Expand All @@ -156,6 +156,6 @@ methods above, and when saving data back to the Firebase database.

You can read more about extending the `$firebaseObject` and `$firebaseArray`
services in the
[API reference](https://angularfire.firebaseapp.com/api.html#angularfire-extending-the-services).
[API reference](/docs/reference.md#extending-the-services).

The sections of this guide so far have taken us on a tour through the functionality provided by the AngularFire library, but there is still more that can be done with the combination of Firebase and Angular. The [next section](beyond-angularfire.md) takes us beyond AngularFire to see what else is possible.
6 changes: 3 additions & 3 deletions docs/guide/introduction-to-angularfire.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Firebase provides several key advantages for [Angular](https://angular.io/) appl
our [flexible Security Rules](https://firebase.google.com/docs/database/security/) rules, you can
have complete control of your data without any server-side hardware or code.
3. **Built-in authentication:** Firebase provides an [authentication and user management
service](https://firebase.google.com/docs/database/security/) which interfaces with OAuth service
service](https://firebase.google.com/docs/auth/) which interfaces with OAuth service
providers like Facebook and Twitter, as well as anonymous and email / password authentication
tools. You can even integrate with an existing authentication service using Firebase custom
authentication.
Expand Down Expand Up @@ -46,7 +46,7 @@ general, deeply nested collections [should typically be avoided](https://firebas
in distributed systems.

While AngularFire abstracts a lot of complexities involved in synchronizing data, it is not required
to use Angular with Firebase. Alternatives are covered in the [Beyond AngularFire](../beyond-angularfire.md)
to use Angular with Firebase. Alternatives are covered in the [Beyond AngularFire](./beyond-angularfire.md)
section of this guide.


Expand Down Expand Up @@ -194,7 +194,7 @@ worry about when it be available.
```

It's also possible to do this directly in the controller by using the
[`$loaded()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-loaded) method.
[`$loaded()`](/docs/reference.md#loaded) method.
However, this method should be used with care as it's only called once after initial load. Using it
for anything but debugging is usually a poor practice.

Expand Down
22 changes: 11 additions & 11 deletions docs/guide/synchronized-arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

Synchronized arrays should be used for any list of objects that will be sorted, iterated, and which
have unique IDs. The synchronized array assumes that items are added using
[`$add()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray-addnewdata), and
[`$add()`](/docs/reference.md#addnewdata), and
that they will therefore be keyed using Firebase
[push IDs](https://firebase.google.com/docs/database/web/save-data).

We create a synchronized array with the `$firebaseArray` service. The array is [sorted in the same
order](https://firebase.google.com/docs/database/web/save-data) as the records on the server. In
other words, we can pass a [query](https://firebase.google.com/docs/database/web/save-data#section-queries)
order](https://firebase.google.com/docs/database/web/retrieve-data#sort_data) as the records on the server. In
other words, we can pass a [query](https://firebase.google.com/docs/database/web/retrieve-data#filtering_data)
into the synchronized array, and the records will be sorted according to query criteria.

While the array isn't technically read-only, it has some special requirements for modifying the
Expand Down Expand Up @@ -79,16 +79,16 @@ We also have access to the key for the node where each message is located via `$

The table below highlights some of the common methods on the synchronized array. The complete list
of methods can be found in the
[API documentation](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray) for
[API documentation](/docs/reference.md#firebasearray) for
`$firebaseArray`.

| Method | Description |
| ------------- | ------------- |
| [`$add(data)`](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray-addnewdata) | Creates a new record in the array. Should be used in place of `push()` or `splice()`. |
| [`$remove(recordOrIndex)`](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray-removerecordorindex) | Removes an existing item from the array. Should be used in place of `pop()` or `splice()`. |
| [`$save(recordOrIndex)`](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray-saverecordorindex) | Saves an existing item in the array. |
| [`$getRecord(key)`](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray-getrecordkey) | Given a Firebase database key, returns the corresponding item from the array. It is also possible to find the index with `$indexFor(key)`. |
| [`$loaded()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray-loaded) | Returns a promise which resolves after the initial records have been downloaded from our database. This is only called once and should be used with care. See [Extending Services](extending-services.md) for more ways to hook into server events. |
| [`$add(data)`](/docs/reference.md#addnewdata) | Creates a new record in the array. Should be used in place of `push()` or `splice()`. |
| [`$remove(recordOrIndex)`](/docs/reference.md#removerecordorindex) | Removes an existing item from the array. Should be used in place of `pop()` or `splice()`. |
| [`$save(recordOrIndex)`](/docs/reference.md#saverecordorindex) | Saves an existing item in the array. |
| [`$getRecord(key)`](/docs/reference.md#getrecordkey) | Given a Firebase database key, returns the corresponding item from the array. It is also possible to find the index with `$indexFor(key)`. |
| [`$loaded()`](/docs/reference.md#loaded-1) | Returns a promise which resolves after the initial records have been downloaded from our database. This is only called once and should be used with care. See [Extending Services](extending-services.md) for more ways to hook into server events. |


## Meta Fields on the Array
Expand All @@ -98,7 +98,7 @@ Similar to synchronized objects, each item in a synchronized array will contain
| Method | Description |
| ------------- | ------------- |
| `$id` | The key for each record. This is equivalent to each record's path in our database as it would be returned by `ref.key()`. |
| `$priority` | The [priority](https://firebase.google.com/docs/database/web/retrieve-data#ordering-by-priority) of each child node is stored here for reference. Changing this value and then calling `$save()` on the record will also change the priority on the server and potentially move the record in the array. |
| `$priority` | The [priority](https://firebase.google.com/docs/database/web/retrieve-data#sorting_and_filtering_data) of each child node is stored here for reference. Changing this value and then calling `$save()` on the record will also change the priority on the server and potentially move the record in the array. |
| `$value` | If the data for this child node is a primitive (number, string, or boolean), then the record itself will still be an object. The primitive value will be stored under `$value` and can be changed and saved like any other field. |


Expand Down Expand Up @@ -210,7 +210,7 @@ app.controller("ChatCtrl", ["$scope", "chatMessages",
</div>
```

Head on over to the [API reference](https://angularfire.firebaseapp.com/api.html#angularfire-firebasearray)
Head on over to the [API reference](/docs/reference.md#firebasearray)
for `$firebaseArray` to see more details for each API method provided by the service. Now that we
have a grasp of synchronizing data with AngularFire, the [next section](user-auth.md) of this guide
moves on to a different aspect of building applications: user authentication.
18 changes: 9 additions & 9 deletions docs/guide/synchronized-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ below would print the content of the profile in JSON format.
```

Changes can be saved back to the server using the
[`$save()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-save) method.
[`$save()`](/docs/reference.md#save) method.
This could, for example, be attached to an event in the DOM view, such as `ng-click` or `ng-change`.

```html
Expand All @@ -67,10 +67,10 @@ The synchronized object is created with several special $ properties, all of whi

| Method | Description |
| ------------- | ------------- |
| [`$save()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-save) | Synchronizes local changes back to the remote database. |
| [`$remove()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-remove) | Removes the object from the database, deletes the local object's keys, and sets the local object's `$value` to `null`. It's important to note that the object still exists locally, it is simply empty and we are now treating it as a primitive with a value of `null`. |
| [`$loaded()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-loaded) | Returns a promise which is resolved when the initial server data has been downloaded. |
| [`$bindTo()`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-bindtoscope-varname) | Creates a three-way data binding. Covered below in the [Three-way Data Bindings](#three-way-data-bindings) section. |
| [`$save()`](/docs/reference.md#save) | Synchronizes local changes back to the remote database. |
| [`$remove()`](/docs/reference.md#remove) | Removes the object from the database, deletes the local object's keys, and sets the local object's `$value` to `null`. It's important to note that the object still exists locally, it is simply empty and we are now treating it as a primitive with a value of `null`. |
| [`$loaded()`](/docs/reference.md#loaded) | Returns a promise which is resolved when the initial server data has been downloaded. |
| [`$bindTo()`](/docs/reference.md#bindtoscope-varname) | Creates a three-way data binding. Covered below in the [Three-way Data Bindings](#three-way-data-bindings) section. |


## Meta Fields on the Object
Expand All @@ -79,9 +79,9 @@ The synchronized object is created with several special `$` properties, all of w

| Method | Description |
| ------------- | ------------- |
| [`$id`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-id) | The key for this record. This is equivalent to this object's path in our database as it would be returned by `ref.key()`. |
| [`$priority`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-priority) | The priority of each child node is stored here for reference. Changing this value and then calling `$save()` on the record will also change the object's priority on the server. |
| [`$value`](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject-value) | If the data in our database is a primitive (number, string, or boolean), the `$firebaseObject()` service will still return an object. The primitive value will be stored under `$value` and can be changed and saved like any other child node. See [Working with Primitives](#working-with-primitives) for more details. |
| [`$id`](/docs/reference.md#id) | The key for this record. This is equivalent to this object's path in our database as it would be returned by `ref.key()`. |
| [`$priority`](/docs/reference.md#priority) | The priority of each child node is stored here for reference. Changing this value and then calling `$save()` on the record will also change the object's priority on the server. |
| [`$value`](/docs/reference.md#value) | If the data in our database is a primitive (number, string, or boolean), the `$firebaseObject()` service will still return an object. The primitive value will be stored under `$value` and can be changed and saved like any other child node. See [Working with Primitives](#working-with-primitives) for more details. |


## Full Example
Expand Down Expand Up @@ -240,7 +240,7 @@ obj.$remove().then(function() {
});
```

Head on over to the [API reference](https://angularfire.firebaseapp.com/api.html#angularfire-firebaseobject)
Head on over to the [API reference](/docs/reference.md#firebaseobject)
for `$firebaseObject` to see more details for each API method provided by the service. But not all
of your data is going to fit nicely into a plain JavaScript object. Many times you will have lists
of data instead. In those cases, you should use AngularFire's `$firebaseArray` service, which we
Expand Down
Loading