File

src/app/contacts/shared/contact/contact.service.ts

Index

Methods

Constructor

constructor(http: AuthHttp)
Parameters :
Name Type Optional Description
http AuthHttp

Methods

createContact
createContact(contact: Contact)
Parameters :
Name Type Optional Description
contact Contact
Returns : any
deleteContact
deleteContact(id: number)
Parameters :
Name Type Optional Description
id number
Returns : any
updateContact
updateContact(contact: Contact)
Parameters :
Name Type Optional Description
contact Contact
Returns : any
import {Injectable} from "@angular/core";
import {AuthHttp} from "../../../core/auth/auth-http.service";
import {Contact} from "../contact.model";


@Injectable()
export class ContactService {

  constructor(private http: AuthHttp) {
  }

  createContact(contact: Contact) {
    return this.http.post('/api/v1/contacts/create', JSON.stringify(contact)).map(res => res.json())
  }

  updateContact(contact: Contact) {
    return this.http.put('/api/v1/contacts/update/' + contact.id, JSON.stringify(contact)).map(res => res.json())
  }

  deleteContact(id: number) {
    return this.http.delete('/api/v1/contacts/delete/' + id).map(res => res.json())
  }

}

results matching ""

    No results matching ""