Last change
on this file since dedbf60 was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 4 weeks ago |
split group project and individual project into two separate folders
|
-
Property mode
set to
100644
|
File size:
644 bytes
|
Rev | Line | |
---|
[baf4cc4] | 1 | import { Injectable } from '@angular/core';
|
---|
| 2 | import {Observable} from "rxjs";
|
---|
| 3 | import {HttpClient} from "@angular/common/http";
|
---|
| 4 | import {Line} from "../../model/Line";
|
---|
| 5 | import {Direction} from "../../model/Direction";
|
---|
| 6 | import {LineDirection} from "../../model/LineDirection";
|
---|
| 7 |
|
---|
| 8 | @Injectable({
|
---|
| 9 | providedIn: 'root'
|
---|
| 10 | })
|
---|
| 11 | export class LineService {
|
---|
| 12 | private url = '/api/lines'
|
---|
| 13 | constructor(private _http: HttpClient) { }
|
---|
| 14 |
|
---|
| 15 | getAll(): Observable<Line[]> {
|
---|
| 16 | return this._http.get<Line[]>(`${this.url}`)
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | getDirections(line: Line): Observable<LineDirection[]> {
|
---|
| 20 | return this._http.get<LineDirection[]>(`${this.url}/${line.id}/directions`)
|
---|
| 21 | }
|
---|
| 22 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.