Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

Commit c4127e6

Browse files
authored
Merge pull request #841 from firebase/modulefire
fix(modules): Separate AngularFire services into modules
2 parents 8a32f0c + d399c05 commit c4127e6

19 files changed

+37
-31
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var FirebaseAuth;
44

55
// Define a service which provides user authentication and management.
6-
angular.module('firebase').factory('$firebaseAuth', [
6+
angular.module('firebase.auth').factory('$firebaseAuth', [
77
'$q', '$firebaseUtils', function($q, $firebaseUtils) {
88
/**
99
* This factory returns an object allowing you to manage the client's authentication state.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
}
77
FirebaseAuthService.$inject = ['$firebaseAuth'];
88

9-
angular.module('firebase')
9+
angular.module('firebase.auth')
1010
.factory('$firebaseAuthService', FirebaseAuthService);
1111

1212
})();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* var list = new ExtendedArray(ref);
4848
* </code></pre>
4949
*/
50-
angular.module('firebase').factory('$firebaseArray', ["$log", "$firebaseUtils", "$q",
50+
angular.module('firebase.database').factory('$firebaseArray', ["$log", "$firebaseUtils", "$q",
5151
function($log, $firebaseUtils, $q) {
5252
/**
5353
* This constructor should probably never be called manually. It is used internally by
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* var obj = new ExtendedObject(ref);
2323
* </code></pre>
2424
*/
25-
angular.module('firebase').factory('$firebaseObject', [
25+
angular.module('firebase.database').factory('$firebaseObject', [
2626
'$parse', '$firebaseUtils', '$log', '$q',
2727
function($parse, $firebaseUtils, $log, $q) {
2828
/**
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
};
4141
}
4242

43-
angular.module('firebase')
43+
angular.module('firebase.database')
4444
.provider('$firebaseRef', FirebaseRef);
4545

4646
})();

src/firebase.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/** @deprecated */
77
.factory("$firebase", function() {
88
return function() {
9+
//TODO: Update this error to speak about new module stuff
910
throw new Error('$firebase has been removed. You may instantiate $firebaseArray and $firebaseObject ' +
1011
'directly now. For simple write operations, just use the Firebase ref directly. ' +
1112
'See the AngularFire 1.0.0 changelog for details: https://github.com/firebase/angularfire/releases/tag/v1.0.0');

src/module.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
(function(exports) {
22
"use strict";
33

4-
// Define the `firebase` module under which all AngularFire
5-
// services will live.
6-
angular.module("firebase", [])
7-
//todo use $window
8-
.value("Firebase", exports.Firebase);
4+
angular.module("firebase.utils", []);
5+
angular.module("firebase.config", []);
6+
angular.module("firebase.auth", ["firebase.utils"]);
7+
angular.module("firebase.database", ["firebase.utils"]);
98

10-
})(window);
9+
// Define the `firebase` module under which all AngularFire
10+
// services will live.
11+
angular.module("firebase", ["firebase.utils", "firebase.config", "firebase.auth", "firebase.database"])
12+
//TODO: use $window
13+
.value("Firebase", exports.firebase)
14+
.value("firebase", exports.firebase);
15+
})(window);

src/utils.js renamed to src/utils/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function() {
22
'use strict';
33

4-
angular.module('firebase')
4+
angular.module('firebase.utils')
55
.factory('$firebaseConfig', ["$firebaseArray", "$firebaseObject", "$injector",
66
function($firebaseArray, $firebaseObject, $injector) {
77
return function(configOpts) {

tests/initialize-node.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ if (!process.env.ANGULARFIRE_TEST_DB_URL) {
77

88
try {
99
firebase.initializeApp({
10-
databaseURL: process.env.ANGULARFIRE_TEST_DB_URL,
11-
serviceAccount: path.resolve(__dirname, './key.json')
10+
databaseURL: process.env.ANGULARFIRE_TEST_DB_URL
1211
});
1312
} catch (err) {
1413
console.log('Failed to initialize the Firebase SDK [Node]:', err);

tests/protractor/chat/chat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var app = angular.module('chat', ['firebase']);
1+
var app = angular.module('chat', ['firebase.database']);
22

33
app.controller('ChatCtrl', function Chat($scope, $firebaseObject, $firebaseArray) {
44
// Get a reference to the Firebase

0 commit comments

Comments
 (0)