PARSE response into ion-item

#1

I have this Response from an http get and I need it to be parsed and displayed only the body row per row for each wifi name.

Response {_body: “iPhone di Traian,-27;RGI-Guest,-75;SYSMAN,-61;OneP…F,-82;iPhone de Monsieur SASSI,-82;PinkFloyd,-65;”, status: 200, ok: true, statusText: “OK”, headers: Headers, …}

WIFI NAME AND SIGNAL for each line, this is my code:

wifiScan() {
    this.http.get('http://192.168.4.1/scan')
    .subscribe(data => {
        console.log(data);
    });
  }

And my html looks like this:

<ion-content padding>
  <ion-item *ngFor="let wifi of wifiList">
    {{wifi.wifiList}}
</ion-item>
</ion-content>

How can I solve this?

#2

Hi @tomeskrt1 :wave:

Where is the wifi property assigned for the ngFor?

In any case, you’ll have to get the body from the response and split in it parts, first using body.split(';') to get each network and then network.split(',') in each to separate the SSID from the signal level. You can also use a regular expression to extract all the parts from the string.

Best,
Rodrigo

#3

it’s not working for me, I’ve already tried, can you please provide me with some code?

#4

Please post the code that you’ve tried so others can help you. Otherwise, is like you’re asking for someone to code for you for free :slightly_smiling_face: