1
|
import {Injectable} from '@angular/core';
|
2
|
import {Http, Response, Headers, RequestOptions} from '@angular/http';
|
3
|
import {Email} from './email';
|
4
|
|
5
|
@Injectable()
|
6
|
export class EmailService {
|
7
|
|
8
|
constructor(private http:Http) {
|
9
|
}
|
10
|
|
11
|
sendEmail(url: string, email: Email) {
|
12
|
let headers = new Headers({'Content-Type': 'application/json'});
|
13
|
let options = new RequestOptions({headers: headers});
|
14
|
let body = JSON.stringify(email);
|
15
|
|
16
|
console.log(body);
|
17
|
|
18
|
return this.http.post(url, body, options)
|
19
|
.do(request => console.log("Insert Response:"+request.status));
|
20
|
}
|
21
|
|
22
|
}
|