How to handle string as return type in angular 8.

Aman Sharma
0

Some times we want to get simple string as a return type from web api. How to handle string as return type in angular 8 is given below. 

 

GetData(Id:number): Observable<string> {

    var headers = new HttpHeaders().set('Content-Type''text/plain; charset=utf-8');

    return this.httpClient.get<any>(this.linkurl+getCarList? Id ='+ Id, { headers, responseType: 'text' as 'json' });  

    }

 

 

 

Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !