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 categories module

The category module will hold all of the logic that is necessary to perform CRUD operations on categories and communicate with the backend through an Angular service.

Category service

The category service is going to be fairly simple, it's only going to manage the CRUD operations on categories. The following steps will describe the process to achieve this:

  1. Create a file called public/app/categories/category.service.js.
  2. Add the necessary business logic:
    import { Injectable } from 'angular2/core'; import { Http, Response, Headers } from 'angular2/http'; import { Observable } from 'rxjs/Observable'; import { Subject } from 'rxjs/Subject'; import { BehaviorSubject } from 'rxjs/Subject/BehaviorSubject'; import { AuthHttp } from '../auth/index'; ...

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