This project showcases RxJS observables and operators and how they can be combined to perform tasks of varying difficulty. Also included is one slightly more involved example that combines the power of observables with a realtime database via Firebase.
- You will need to have NodeJS and NPM installed from nodejs.org
- If you want to run the Firebase example, you will need a Google account
Run the following in the terminal or command prompt to download and enter the project:
git clone https://github.com/UltimateAngular/hello-rxjs.git
cd hello-rxjs
Run the following commands in the project directory to install dependencies and start the app:
npm i
npm start # or ng serve
Then navigate to http://localhost:4200 and the app will be running.
In order to view the Firebase example, you will need to take a couple extra steps.
Navigate to https://firebase.google.com/ and click the "GET STARTED FOR FREE" button. Once you have signed in via Google, you will have access to your Firebase console.
From your Firebase console, click "CREATE NEW PROJECT". Then fill in the necessary details and go to that project's dashboard. Then click the "Add Firebase To Your Web App" button toward the top-right of the screen.
Open the project in a code editor and navigate to src > app > app.module.ts
. Then replace the data in the firebaseConfig
constant with the information showing in your project's dashboard. Last but not least, save the file.
Note: make sure you are in one of the
08-realtime-streams
branches, otherwise you will not see the constant inapp.module.ts
.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive/pipe/service/class
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.