O'Reilly logo

Web Application Development with MEAN by Robert Onodi, Adrian Mejia, Amos Q. Haviv

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The expenses module

In this module, we are going to treat functionality related to expenses. This is going to be the main module used by our users in the frontend application, because here they will add new expenses and store them in MongoDB through our backend API.

Expense service

The expense service will implement CRUD operations on expenses and one other important feature of it is getting the balance of expenses. In order to create the expense service, we will follow these steps:

  1. Create a file called public/src/expense/expense.service.js.
  2. Define the main logic of the service:
    import { Injectable } from 'angular2/core'; import { Http, Response, Headers } from 'angular2/http'; import { Observable } from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required