I am trying to use PRIMENG scheduler in following Angular version. When I am trying to create eventservice for scheduler (following code) and system throws following error
"TS2304: Cannot find name 'HttpClient'"
export class EventService {
constructor(private httpClient: HttpClient) {}
getEvents() {
return this.httpClient
.get('showcase/resources/data/scheduleevents.json')
.toPromise()
.then(res => <any[]>res.json().data)
.then(data => {
return data;
});
}
}
module.ts:
import {
RadioButtonModule,
KeyFilterModule,
DialogModule,
DropdownModule,
InputTextModule,
ScheduleModule,
TabViewModule,
MessagesModule,
} from 'primeng/primeng';
import { HttpClientModule } from '@angular/common/http';
import { HttpModule } from '@angular/http';
import { Injectable } from '@angular/core';
Angular version: Angular CLI: 6.0.8 Node: 8.11.3
Angular: 6.0.9 - animations, common, compiler, compiler-cli, core, forms http, language-service, platform-browser platform-browser-dynamic, router
I found the above piece of code in primeng website and looks like, this code implemented for Angular 2+ and Http is depreciated in Angular 6 https://www.primefaces.org/primeng/#/schedule
Can some throw some light on the same? Any help is highly appreciated.