Skip to content
Snippets Groups Projects
Commit e1848092 authored by Lukas Mauß's avatar Lukas Mauß Committed by Thomas Lenz
Browse files

Add room service with first function 'getRooms()'

parent f2e36c8d
No related merge requests found
import { TestBed, inject } from '@angular/core/testing';
import { RoomService } from './room.service';
describe('RoomService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [RoomService]
});
});
it('should be created', inject([RoomService], (service: RoomService) => {
expect(service).toBeTruthy();
}));
});
import { Injectable } from '@angular/core';
import { Room } from './room';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
};
@Injectable()
export class RoomService {
private roomsUrl = 'api/rooms';
constructor(private http: HttpClient) {
}
getRooms(): Observable<Room[]> {
return this.http.get<Room[]>(this.roomsUrl);
}
}
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