Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

How to resolve an array type instead of type {}

$
0
0

@lolaswift1 wrote:

My provider does this:

return new Promise(resolve => {
this.http.post(this.apiUrl+’/getData’, requestData, options).subscribe(data => {
resolve(data[‘response’][‘arrData’]);
}, err => {
console.log(err);
});
});

My components:
getData() {
this.dataProvider.getData()
.then(data => {
this.arrData = data;
console.log(data.length);
});
}

The data I get is finally indeed an array of object but I can’t treat ‘data’ as an array. The compiler complaints that it’s type {}.

New to typescript. Any help would be much appreciated.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>