Skip to content

Commit 842f3cd

Browse files
committed
fix(providers): remove DEFAULT_ DEFAULT_FIREBASE_REF and DEFAULT_FIREBASE
BREAKING CHANGE: The tokens to inject the root firebase url and reference have changed from DEFAULT_FIREBASE -> FirebaseUrl DEFAULT_FIREBASE_REF -> FirebaseRef Closes #25
1 parent 3c8905b commit 842f3cd

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ import {FIREBASE_PROVIDERS} from 'angularfire2';
2222
bootstrap(App, FIREBASE_PROVIDERS);
2323
```
2424

25-
### DEFAULT_FIREBASE_REF
25+
### FirebaseRef
2626

2727
Injectable symbol to create a Firebase reference based on
28-
the url provided by `DEFAULT_FIREBASE`.
28+
the url provided by `FirebaseUrl`.
2929

3030
Type: `Firebase`
3131

3232
Usage:
3333

3434
```
3535
import {Inject} from 'angular2/core';
36-
import {DEFAULT_FIREBASE_REF} from 'angularfire2';
36+
import {FirebaseRef} from 'angularfire2';
3737
...
3838
class MyComponent {
39-
constructor(@Inject(DEFAULT_FIREBASE_REF) ref:Firebase) {
39+
constructor(@Inject(FirebaseRef) ref:Firebase) {
4040
ref.on('value', this.doSomething);
4141
}
4242
}
4343
```
4444

45-
### DEFAULT_FIREBASE
45+
### FirebaseUrl
4646

4747
URL for the app's default Firebase database.
4848

@@ -53,11 +53,11 @@ Usage:
5353
```
5454
import {App} from './app';
5555
import {bootstrap, provide} from 'angular2/core';
56-
import {DEFAULT_FIREBASE, FIREBASE_PROVIDERS} from 'angularfire2';
56+
import {FirebaseUrl, FIREBASE_PROVIDERS} from 'angularfire2';
5757
5858
bootstrap(App, [
5959
FIREBASE_PROVIDERS,
60-
provide(DEFAULT_FIREBASE, {
60+
provide(FirebaseUrl, {
6161
useValue: 'https://my.firebaseio.com'
6262
})
6363
]);
@@ -81,7 +81,7 @@ import {FirebaseList} from 'angularfire2';
8181
providers: [
8282
FirebaseList({
8383
token: Question, // Token used to inject in the constructor
84-
path: '/questions', // Will append to the DEFAULT_FIREBASE if relative
84+
path: '/questions', // Will append to the FirebaseUrl if relative
8585
}),
8686
// Passing just a string will make that the path AND the token used with @Inject
8787
FirebaseList('/topics')

src/angularfire.spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import {describe,it,beforeEach} from 'angular2/testing';
22
import {Injector, provide} from 'angular2/core';
3-
import {FIREBASE_PROVIDERS, DEFAULT_FIREBASE, DEFAULT_FIREBASE_REF} from './angularfire';
3+
import {FIREBASE_PROVIDERS, FirebaseUrl, FirebaseRef} from './angularfire';
44

55
describe('angularfire', () => {
6-
describe('DEFAULT_FIREBASE_REF', () => {
7-
it('should provide a FirebaseRef for the DEFAULT_FIREBASE_REF binding', () => {
6+
describe('FIREBASE_REF', () => {
7+
it('should provide a FirebaseRef for the FIREBASE_REF binding', () => {
88
var injector = Injector.resolveAndCreate([
9-
provide(DEFAULT_FIREBASE, {
9+
provide(FirebaseUrl, {
1010
useValue: 'https://ng2-forum-demo.firebaseio.com'
1111
}),
1212
FIREBASE_PROVIDERS
1313
]);
14-
expect(typeof injector.get(DEFAULT_FIREBASE_REF).on).toBe('function');
14+
expect(typeof injector.get(FirebaseRef).on).toBe('function');
1515
})
1616
});
1717
});

src/angularfire.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import {OpaqueToken, provide} from 'angular2/core';
22
import * as Firebase from 'firebase';
33

4-
export const DEFAULT_FIREBASE = new OpaqueToken('DEFAULT_FIREBASE');
5-
export const DEFAULT_FIREBASE_REF = new OpaqueToken('DEFAULT_FIREBASE_REF')
4+
export const FirebaseUrl = new OpaqueToken('FirebaseUrl');
5+
export const FirebaseRef = new OpaqueToken('FirebaseRef');
66

77
export const FIREBASE_PROVIDERS:any[] = [
8-
provide(DEFAULT_FIREBASE_REF, {
8+
provide(FirebaseRef, {
99
useFactory: (url:string) => new Firebase(url),
10-
deps: [DEFAULT_FIREBASE]})
10+
deps: [FirebaseUrl]})
1111
];
1212

1313
export {FirebaseList, FirebaseListConfig} from './providers/firebase_list';

src/providers/firebase_list.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {beforeEach, fit, inject, it, describe, expect, TestComponentBuilder} fro
55
import * as Firebase from 'firebase';
66

77
import {FirebaseList, FirebaseListFactory, onChildAdded, onChildMoved} from './firebase_list';
8-
import {DEFAULT_FIREBASE, FirebaseObservable} from '../angularfire';
8+
import {FirebaseUrl, FirebaseObservable} from '../angularfire';
99

1010
enableProdMode();
1111

@@ -40,7 +40,7 @@ const sharedTemplate = `
4040
token: Todo,
4141
path: '/todos'
4242
}),
43-
provide(DEFAULT_FIREBASE, {
43+
provide(FirebaseUrl, {
4444
useValue: rootFirebase
4545
})
4646
]
@@ -59,7 +59,7 @@ class MyComponent {
5959
providers: [
6060
FirebaseList('/posts'),
6161
FirebaseList('/todos'),
62-
provide(DEFAULT_FIREBASE, {
62+
provide(FirebaseUrl, {
6363
useValue: rootFirebase
6464
})
6565
]

src/providers/firebase_list.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Provider} from 'angular2/core';
2-
import {DEFAULT_FIREBASE} from '../angularfire';
2+
import {FirebaseUrl} from '../angularfire';
33
import {Observer} from 'rxjs/Observer';
44
import {FirebaseObservable} from '../utils/firebase_observable';
55
import {absolutePathResolver} from '../utils/absolute_path_resolver';
@@ -13,7 +13,7 @@ export function FirebaseList (config?:FirebaseListConfig|string):Provider {
1313
var normalConfig = normalizeConfig(config);
1414
return new Provider(normalConfig.token, {
1515
useFactory: (defaultFirebase:string) => FirebaseListFactory(absolutePathResolver(defaultFirebase, normalConfig.path)),
16-
deps: [DEFAULT_FIREBASE]
16+
deps: [FirebaseUrl]
1717
})
1818
}
1919

test/e2e/firebase_list/firebase_list_example.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {Component, Inject, provide} from 'angular2/core';
22
import {bootstrap} from 'angular2/platform/browser';
3-
import {DEFAULT_FIREBASE, FirebaseList, FirebaseObservable} from 'angularfire2';
3+
import {FIREBASE_URL, FirebaseList, FirebaseObservable} from 'angularfire2';
44
// var Firebase = require('firebase');
55
import Firebase from 'firebase';
66
const rootFirebase = 'https://answers-mobile.firebaseio.com/';
@@ -27,6 +27,6 @@ class App {
2727
}
2828

2929
bootstrap(App, [
30-
provide(DEFAULT_FIREBASE, {
30+
provide(FIREBASE_URL, {
3131
useValue: rootFirebase
3232
})]);

0 commit comments

Comments
 (0)