groceries-angular-service
by sebawita | v0.1.0
Angular Service to be used with the sample groceries project
npm i --save groceries-angular-service

groceries-angular-service

Setup

In order to make the service work you need to add an HttpModule to your @NgModule imports.

For NativeScript use NativeScriptHttpModule

import { NativeScriptHttpModule } from "nativescript-angular/http";
@NgModule({
...
imports: [
...
NativeScriptHttpModule
],

For Web use HttpModule

import { HttpModule } from '@angular/http';
@NgModule({
...
imports: [
...
NativeScriptHttpModule
],

Adding to providers

To provide the GroceryListService and UserService services, just import them from groceries-angular-service and add them to the @NgModule providers:

import { GroceryListService, UserService } from 'groceries-angular-service';

@NgModule({
...
providers: [
...
GroceryListService,
UserService
],