Skip to content
Snippets Groups Projects
Commit a7302a90 authored by Hagen Dreßler's avatar Hagen Dreßler
Browse files

Edit service comment (add function addComment)

parent 7f5c6471
1 merge request!54Resolve "comment creation - creator component logic"
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
const httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' })
};
@Injectable() @Injectable()
export class CommentService { export class CommentService {
private commentsUrl = 'api/comments';
constructor() { } constructor( private http: HttpClient ) {
}
addComment(comment: Comment): Observable<Comment> {
return this.http.post<Comment>(this.commentsUrl, comment, httpOptions);
}
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment