File

src/app/api.service.ts

Index

Properties
Methods

Constructor

constructor(httpClient: HttpClient)
Parameters :
Name Type Optional
httpClient HttpClient No

Methods

fetch
fetch()
Returns : Observable<Item[]>

Properties

Private dataURL
Type : string
Default value : "https://www.techiediaries.com/api/data.json"
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);
	}
}

result-matching ""

    No results matching ""