This project is the result of my code-along at the end of the video series Angular & FireStore Application by Brad Traversy. His original code repo may be found here. My code is similar, but has several minor design changes. Instructions on how to deploy this code to Firebase are included.
This project was generated with Angular CLI version 1.6.2.
- Angular CLI v1.6.3
- Angular v5.1.2
- Angular Fire 2 v5.0.0-rc.4
- Firebase CLI v3.16.0
- Firebase v4.8.0
To begin working with this project, perform the following tasks:
-
Clone this repo:
git clone https://github.com/Stanza987/angular-firestore.git
-
cd
into the folder of the cloned repo -
Run
yarn install
to install dependencies -
Add your Firebase configuration to
environment.ts
andenvironment.prod.ts
export const environment = { production: false, //change to true for environment.prod.ts firebase: { apiKey: '<your-key>', authDomain: '<your-project-authdomain>', databaseURL: '<your-database-URL>', projectId: '<your-project-id>', storageBucket: '<your-storage-bucket>', messagingSenderId: '<your-messaging-sender-id>' } };
-
Uncomment Firestore API endpoints in
item.service.ts
to enable CRUD functionality.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng build --prod
to build the project. The static assets will be stored in the dist/
directory.
- Run
ng build --prod
- Run
firebase init
and chooseHosting
, follow the on-screen prompts. - Delete the
public
directory automatically generated by the Firebase CLI - Change
firebase.json
to{ "hosting": { "public": "dist", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } }
- Run
firebase deploy