Weiheng Li Weiheng Li - 1 month ago 11
AngularJS Question

Is it necessary to sign up a account when using Angularfire (firebase)?

I am new in this field and reading such code: https://github.com/PatrickO10/meetUp

When I read some document about firebase here.
https://github.com/firebase/angularfire/blob/master/docs/quickstart.md

<script>
// Initialize the Firebase SDK
var config = {
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
storageBucket: '<your-storage-bucket>'
};
firebase.initializeApp(config);
</script>


It seems we should signup one account and initialize the firebase as above, however, it seems in that case, I can't find such code. all I found is this snippet:

var ref = new Firebase(FBURL);
var services = {
saveNewUser: saveNewUser,
getUserAuth: getUserAuth,
createUser: createUser,
loginWithPwd: loginWithPwd,
setEventRef: setEventRef,
setOnAuth: setOnAuth,
logOutUser: logOutUser,
removeEvent: removeEvent
};
return services;


in https://github.com/PatrickO10/meetUp/blob/master/app/fbAuth/fbAuthService.js

I just to ask why it doesn't look like my document?

Answer

The project at which you are looking is using older versions of Firebase and AngularFire:

<!-- Firebase -->
<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js" defer></script>
<!-- AngularFire -->
<script src="https://cdn.firebase.com/libs/angularfire/1.1.3/angularfire.min.js" defer></script>

And the documentation to which you are referring is for the latest versions. The initialization has changed between versions. There is a migration guide that might assist you extrapolating the usage in the project to the current version AngularFire.

Regarding your question about creating an account, you will need to do that and you did need to do that with the previous version. It's just that the previous version was entirely URL-based. It didn't involve key-based intialization; you simply created a Firebase ref using your project-specific URL.

The documentation for the previous version of Firebase is available here. You will see that the first step mentioned in the guide involves creating an account.

And the documentation for the previous version of AngularFire is here.