Problem with *ngFor

Hello i have a problem returning data from database. The php script and authservice are working fine. this is the response i am getting on XHR

JSON
friendsNewsFeed […]
0 {…}
msg_id 165
message slksdkjds sdjksdj dsddsjdslkjdsk djksdjd sdkljsdj sjdkjsd ksdjlsj
uid_fk 99
ip null
created 1269249260
uploads null
like_count 0
comment_count 0
share_count 0
group_id_fk 0
lat null
lang null
media_pic null
description sddsdsdsd ddssdd sdsdsds
title null
type P
status 1
views_count 0
fan_count 0
country null
point_count 0

This is the script i am putting on home.ts

export class HomePage {
@ViewChild(“updatebox”) updatebox;

public photos: any;
public base64Image: string;
public fileImage: string;
public userDetails: any;
public resposeData: any;
public dataSet: any;
public noRecords: boolean;
userPostData = {
    uid: "",
    token: "",
    created: "",
    message: ""
};

constructor(
    public common: Common,
    private alertCtrl: AlertController,
    private camera: Camera,
    public navCtrl: NavController,
    public app: App,
    public authService: AuthService
) {
    const data = JSON.parse(localStorage.getItem("userData"));
    this.userDetails = data.userData;
    this.userPostData.uid = this.userDetails.uid;
    this.userPostData.token = this.userDetails.token;
    this.userPostData.created = "";
    this.noRecords = false
    this.getFeed();
}

ngOnInit() {
    this.dataSet = [];
}

  getFeed() {
    this.common.presentLoading();
    this.authService.postData(this.userPostData, "userNewsFeed").then(
        result => {
            this.resposeData = result;
            if (this.resposeData.friendsNewsFeed) {
                this.common.closeLoading();
                this.dataSet = this.resposeData.friendsNewsFeed;
                console.log(this.dataSet);
               
            } else {
                console.log("No access");
            }
        },
        err => {
            //Connection failed message
        }
    );
}

authservice.ts

@Injectable()
export class AuthService {

constructor(public http: Http) {
console.log(‘Hello AuthService Provider’);
}

postData(credentials, type){

return new Promise((resolve, reject) =>{
  let headers = new Headers();
  this.http.post(apiUrl+type, JSON.stringify(credentials), {headers: headers}).
  subscribe(res =>{
    resolve(res.json());
  }, (err) =>{
    reject(err);
  });

});

}

}

home.html
<ion-card *ngFor=“let item of dataSet; let msgIndex = index”>


<p [innerHTML]=“item.message | linky”>




This is what i am getting on console

Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
util.js:60
Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
util.js:60
No access

php script

function getFeed(){

try {
     
        $friendsNewsFeed  = '';
        $db = getDB();
      
            $sql = "SELECT * FROM messages ORDER BY msg_id DESC LIMIT 15";
            $stmt = $db->prepare($sql);
            $stmt->bindParam("uid", $uid, PDO::PARAM_INT);
            $stmt->bindParam("created", $created, PDO::PARAM_STR);
      
        $stmt->execute();
        $friendsNewsFeed = $stmt->fetchAll(PDO::FETCH_OBJ);
       
        $db = null;

        if($friendsNewsFeed )
        echo '{"friendsNewsFeed ": ' . json_encode($friendsNewsFeed) . '}';
        else
        echo '{"friendsNewsFeed ": ""}';
    }
   
 catch(PDOException $e) {
    echo '{"error":{"text":'. $e->getMessage() .'}}';
}

}

function userNewsFeed(){
$request = \Slim\Slim::getInstance()->request();
$data = json_decode($request->getBody());
$uid=$data->uid;
$token=$data->token;
$created = $data->created;
$systemToken=apiToken($uid);

try {
     
        $friendsNewsFeed  = '';
        $db = getDB();
        if($created){
		 $sql = "SELECT * FROM messages WHERE uid_fk=:uid AND created < :created ORDER BY msg_id DESC LIMIT 5";
		 $stmt = $db->prepare($sql);
            $stmt->bindParam("uid", $uid, PDO::PARAM_INT);
            $stmt->bindParam("created", $created, PDO::PARAM_STR);
        }
        else{
            $sql = "SELECT * FROM messages WHERE uid_fk=:uid ORDER BY msg_id DESC LIMIT 5";
            $stmt = $db->prepare($sql);
            $stmt->bindParam("uid", $uid, PDO::PARAM_INT);
        }
        $stmt->execute();
        $friendsNewsFeed  = $stmt->fetchAll(PDO::FETCH_OBJ);
       
        $db = null;

        if($friendsNewsFeed)
        echo '{"friendsNewsFeed ": ' . json_encode($friendsNewsFeed) . '}';
        else
        echo '{"friendsNewsFeed ": ""}';
    
   
} catch(PDOException $e) {
    echo '{"error":{"text":'. $e->getMessage() .'}}';
}

}

Have u tried to get your data like this.

this.dataSet= this.resposeData.json().friendsNewsFeed;

if you are getting an array from your server try this way.

this.dataSet= this.resposeData.json()[0].friendsNewsFeed;

also I saw you declare dataSet as an array so may use push to add data to it. hope u it helps.

cheers!!

i am getting this Jose
Error: Uncaught (in promise): TypeError: _this.resposeData.json is not a function

getFeed() {
this.common.presentLoading();
this.authService.postData(this.userPostData, “userNewsFeed”).then(
result => {
this.resposeData = result;
if (this.resposeData) {
this.common.closeLoading();
this.dataSet= this.resposeData.json().friendsNewsFeed;
console.log(this.dataSet);

            } else {
                console.log("No access");
            }
        },
        err => {
            //Connection failed message
        }
    );
}

pardon me, I guide you wrong, i think this is the correct way.

 this.resposeData = result.json();

also keep the dataSet like you had it before my answer
Try it out and let me know.

i am getting the same on result Jose
ERROR Error: Uncaught (in promise): TypeError: result.json is not a function
[160]/HomePage.prototype.getFeed/

import { Component, ViewChild } from “@angular/core”;
import { NavController, App, AlertController } from “ionic-angular”;
import { AuthService } from “…/…/providers/auth-service”;
import { Common } from “…/…/providers/common”;
import { Camera, CameraOptions } from “@ionic-native/camera”;
@Component({ selector: “page-home”, templateUrl: “home.html” })
export class HomePage {
@ViewChild(“updatebox”) updatebox;

public photos: any;
public base64Image: string;
public fileImage: string;
public userDetails: any;
public resposeData: any;
public dataSet: any;
public noRecords: boolean;
userPostData = {
    uid: "",
    token: "",
    created: "",
    message: ""
};

constructor(
    public common: Common,
    private alertCtrl: AlertController,
    private camera: Camera,
    public navCtrl: NavController,
    public app: App,
    public authService: AuthService
) {
    const data = JSON.parse(localStorage.getItem("userData"));
    this.userDetails = data.userData;
    this.userPostData.uid = this.userDetails.uid;
    this.userPostData.token = this.userDetails.token;
    this.userPostData.created = "";
    this.noRecords = false
    this.getFeed();
}

ngOnInit() {
    this.dataSet = [];
}

getFeed() {
    this.common.presentLoading();
    this.authService.postData(this.userPostData, "userNewsFeed").then(
        result => {
            this.resposeData = result.json();
            if (this.resposeData.friendsNewsFeed) {
                this.common.closeLoading();
                this.dataSet= this.resposeData.friendsNewsFeed;
                console.log(this.dataSet);
               
            } else {
                console.log("No access");
            }
        },
        err => {
            //Connection failed message
        }
    );
}



converTime(time) {
    let a = new Date(time * 1000);
    return a;
}

backToWelcome() {
    const root = this.app.getRootNav();
    root.popToRoot();
}



logout() {
    //Api Token Logout

    localStorage.clear();
    setTimeout(() => this.backToWelcome(), 1000);
}

}

i am getting the same on result Jose
ERROR Error: Uncaught (in promise): TypeError: result.json is not a function
[160]/HomePage.prototype.getFeed/