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.
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:
Create a file called
public/app/categories/category.service.js
.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'; import { contentHeaders } from '../common/index'; import { Category } from './category.model'; @Injectable() export class CategoryService { public category: Subject<Category>; public categories: Observable<Array<Category...