src/app/api.service.ts
Properties |
|
Methods |
constructor(httpClient: HttpClient)
|
||||||
Defined in src/app/api.service.ts:20
|
||||||
Parameters :
|
fetch |
fetch()
|
Defined in src/app/api.service.ts:24
|
Returns :
Observable<Item[]>
|
Private dataURL |
Type : string
|
Default value : "https://www.techiediaries.com/api/data.json"
|
Defined in src/app/api.service.ts:20
|
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
export interface Item
{
name: string;
description: string;
url: string;
html: string;
markdown: string;
}
@Injectable({
providedIn: 'root'
})
export class ApiService
{
private dataURL: string = "https://www.techiediaries.com/api/data.json";
constructor(private httpClient: HttpClient) {}
fetch(): Observable<Item[]>
{
return <Observable<Item[]>>this.httpClient.get(this.dataURL);
}
}