- Setup Firebase with project.
- For our purposes, set rules to read and write to true.
- Enable Authentication for Email and Google logins.
- Add Firebase to your web app: obtain the apiKey, authDomain, and databaseURL.
- Optional: upload some sample data via a json file.
- Create folder structure:
- app
|
|- factories
|- controllers
|- app.js
|- values
|
- css
- lib
|
| - bower_components
| - node_modules
| - bower.json
| - Gruntfile.js
| - package.json
|
- partials
- sass
- index.html
- Within
lib
folder, install necessarynode_modules
(runpackage.json
and if necessarybower.json
). Be sure to include Firebase. - Within
values
, create aFBCreds.js
file with your database details: aipKey, authDomain, databaseURL. - Be sure to add js files to
index.html
(third party and app specific) - Add
ng-app="the-name-of-your-app"
toindex.html
- Add routing for various views. Each view will have a corresponding controller.
- Be sure to include
ng-view
in theindex.html
- Create
isAuth
to verify user when viewing routes. app.run
to obtain Firebase credentials.
- Create
navbar.html
partial. Add login and logout. Useng-show
based on value ofisLoggedIn
. - Create
NavCtrl
. - Use
firebase.auth().onAuthStateChanged
to set$scope.isLoggedIn
and allow the navbar to display context related links. - Login and Logout links will change the view (route).
- Add search to partial (if needed) and variable in the controller.
- Partial displays options for login/registraion with links to functions within the controller.
- Controller has items it runs automatically and functions that are called as needed.
- Controller depends on AuthFactory to return promise regarding login/registration.
- Firebase always returns a promise.
- Once a user registers, the login function runs automatically.