I'm a newcomer to TypeScript/Angular and I have a constructor set up to fetch JsonP. Now, I want to add a new constructor for HttpClientModule. Here's my current code:
export class DataService {
constructor(private _jsonp: Jsonp) {
this.apikey = 'xxx';
}
}
This is what I attempted:
export class DataService {
constructor(private _jsonp: Jsonp, private http: HttpClient) {
this.apikey = 'xxx';
}
}
However, the initial JSON API stops working. I am looking for an equivalent solution like this:
export class DataService {
constructor(private _jsonp: Jsonp) {
this.apikey = 'xxx';
}
constructor(http: HttpClient) {}
}