- error NG2003: No suitable injection token for parameter code example

Example 1: Angular 9 : Error NG2003: No suitable injection token for parameter 'url' of class 'DataService'. Found string

//import { Inject } from '@angular/core';

@Inject('url') private url: string;

Example 2: Angular 9 : Error NG2003: No suitable injection token for parameter 'url' of class 'DataService'. Found string

//import { Inject } from '@angular/core';

constructor(@Inject(String) private url: string, private http: Http)