src/app/contacts/shared/contact/contact.service.ts
Methods |
constructor(http: AuthHttp)
|
||||||||
Parameters :
|
createContact | ||||||||
createContact(contact: Contact)
|
||||||||
Parameters :
Returns :
any
|
deleteContact | ||||||||
deleteContact(id: number)
|
||||||||
Parameters :
Returns :
any
|
updateContact | ||||||||
updateContact(contact: Contact)
|
||||||||
Parameters :
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())
}
}