Code Monkey home page Code Monkey logo

angular2-rxjs-examples's Introduction

image

RxJS Examples in Angular 2

This project contains several mini-apps, showcasing RxJS observables and operators and how they can be combined to perform tasks of varying difficulty and awesomeness. Also included are several, more complex "real-world" examples that combine the power of observables with a realtime database from Firebase. Below is a link to a blog post with the AngularConnect talk and slides that facilitated the creation of this project. Oh and there are also some great resources for reactive programming. You're welcome.

#GoBeastModeOrGoHome

Prerequisites

  • You will need to have NodeJS and NPM installed from nodejs.org
  • You will need a Google account (generally associated with Gmail)

Getting the code

Run the following in the terminal or command prompt to download and enter the project:

git clone https://github.com/onehungrymind/angular2-rxjs-examples.git
cd angular2-rxjs-examples

Setting up a Firebase account

Simply 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.

Setting up Firebase in the Angular app

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 copy src > app > firebase.conf.example.ts to src > app > firebase.conf.ts. Then fill in firebase.conf.ts with the information showing in your project's dashboard (note that "storageBucket" is optional and that "messagingSenderId" is not used at all). Last but not least, save the file.

Running the app

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.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive/pipe/service/class.

Build

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.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

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.

angular2-rxjs-examples's People

Contributors

angular-cli avatar jdgarvey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

angular2-rxjs-examples's Issues

01-Maintaining-State typescript error

I'm trying to run 01 example, but I'm getting an error at line 32:
.startWith({x: 100, y: 150})

The error says that

Argument of type '{x: number; y: number; }' is not assignable to parameter of type 'number | Scheduler'. Object literal may only specify known properties, and 'x' does not exist in type 'number | Scheduler'.

After checking startWith documentation, it seems that you can only pass numbers to it. Is there any workaround for this to work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.