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:
- Create a file called
public/src/expense/expense.service.js
. - 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'; ...
Get Web Application Development with MEAN now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.