Hi everybody
I have issue with displaying data returned from signalR.
The date I get from console log is:
{"DetectionId":154,"Data1":"somevalue","Data2":"somevalue","Data3":"somevalue","Data4":"somevalue"}
I want to iterate over each object and display it like:
<ion-item *ngFor="let item of detection">
<h3> {{ item.DetectionId }} </h3>
<h3> {{ item.Data1 }} </h3>
</ion-item>
inside my .ts i have this:
public detection: any[] = [];
connect_sub() {
let conx = this._signalR.createConnection();
let onMessageSent = new BroadcastEventListener('test');
conx.listen(onMessageSent);
onMessageSent.subscribe((message: any) => { // tried [] also dont' go well
console.log(typeof message); // => its object
this.detection = JSON.parse(<string>message);
console.log("Test", this.detection);
});
I’ve tried some options, stringify |json etc… but it wont work.
Pls someone helppp me tnxx