ng2003 Angular 9 : Error NG2003: No suitable injection token for parameter ‘url’ of class ‘DataService’. Found string

The solution for “ng2003 Angular 9 : Error NG2003: No suitable injection token for parameter ‘url’ of class ‘DataService’. Found string” can be found here. The following code will assist you in solving the problem.

//import { Inject } from ‘@angular/core’;

constructor(@Inject(String) private url: string, private http: Http)
//import { Inject } from ‘@angular/core’;

@Inject(‘url’) private url: string;

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in