From my web api, I can see there is formatting for line breaks etc, as below:
address: "11 Ingle Park Way↵LONDON↵NN15 1GN↵United Kingdom"
What I want to know is, how to I bind the data to my view with this formatting. So far I am doing:
<span class="text-gray">{{receivedRequest.address}}</span>
TS file
receivedRequest: any;
constructor(private service: nowService,
private appComponent: AppComponent,
private userService: UserService,
private router: Router,
private http: HttpClient,
private route: ActivatedRoute
) {
this.receivedRequest = { number: '', opened_at: '', description: '', short_description: '', "c_i.serial_number" : "value" }; this.receivedLocation = { city: null, country: null }
}
private getRequest() {
this.service.getServiceRequest(this.s_id, this.c_id).subscribe((data) => {
this.loading = true;
console.log('Result - ', data);
console.log('service data is received');
this.loading = true;
this.receivedRequest = data.result;
this.loading = false;
})
}
.service file
getServiceRequest(s_id, cId): Observable<any> {
return this.http.get<any>(this.servicenowApiUrl + "/" + s_id + "?c_id=" + cId)
.pipe(
catchError(this.handleError)
);
}
<br>elements, or they'll get rendered to single spaces like virtually all other whitespace in HTML.