I am unable to get the data from the server using Native HTTP. The response on the server looks like:
[{feed_id:“1”,feed_title:“Helping the poor and needy people is a good deed”,feed_date:“2017-07-14”,feed_content:“Poverty is a signal of the failure to acquire suitable resources for the achievement of one’s ends.”,feed_likes:“11”,feed_comments:“12”,feed_has_image:“0”,feed_img_url:“no image”},{feed_id:“2”,feed_title:"Information technology in India ",feed_date:“2017-07-12”,feed_content:“Indias IT Services industry was born in Mumbai in 1967 with the establishment of the Tata Group in partnership with Burroughs. The first software export zone, SEEPZ – the precursor to the modern-day IT park – was established in Mumbai in 1973.”,feed_likes:“20”,feed_comments:“15”,feed_has_image:“0”,feed_img_url:“no image”}]
and my code is as follows:
this.http.get('my.php.url', {}, {})
.then(data => {
console.log(data.status);
console.log(data.data); // data received by server
console.log(data.headers);
this.feeds = data.data;
})
.catch(error => {
console.log(error.status);
console.log(error.error); // error message as string
console.log(error.headers);
});
It is very difficult to check the error on device everytime I make change in the code.
below is the log I got from chrome://inspect/#devices
200 main.js:46602
[{feed_id:“1”,feed_title:“Helping the poor and needy people is a good deed”,feed_date:“2017-07-14”,feed_content:“Poverty is a signal of the failure to acquire suitable resources for the achievement of one’s ends.”,feed_likes:“11”,feed_comments:“12”,feed_has_image:“0”,feed_img_url:“no image”},{feed_id:“2”,feed_title:"Information technology in India ",feed_date:“2017-07-12”,feed_content:“Indias IT Services industry was born in Mumbai in 1967 with the establishment of the Tata Group in partnership with Burroughs. The first software export zone, SEEPZ – the precursor to the modern-day IT park – was established in Mumbai in 1973.”,feed_likes:“20”,feed_comments:“15”,feed_has_image:“0”,feed_img_url:“no image”}] main.js:46603
Object {X-Xss-Protection: “1; mode=block”, X-Android-Selected-Transport: “http/1.1”, Access-Control-Allow-Origin: “*”, Date: “Sat, 15 Jul 2017 06:19:52 GMT”, Content-Length: “719”…}
main.js:46604
ERROR Error {} main.js:1362
defaultErrorLogger main.js:1362
ErrorHandler.handleError main.js:1422
IonicErrorHandler.handleError main.js:113941
ApplicationRef_.tick main.js:5360
(anonymous function) main.js:5233
t.invoke polyfills.js:3
inner.inner.fork.onInvoke main.js:4427
t.invoke polyfills.js:3
r.run polyfills.js:3
NgZone.run main.js:4295
ApplicationRef_._this._zone.onMicrotaskEmpty.subscribe.next main.js:5233
schedulerFn main.js:4129
SafeSubscriber.__tryOrUnsub main.js:36538
SafeSubscriber.next main.js:36485
Subscriber._next main.js:36425
Subscriber.next main.js:36389
Subject.next main.js:42443
EventEmitter.emit main.js:4115
NgZone.checkStable main.js:4392
NgZone.setHasMicrotask main.js:4476
inner.inner.fork.onHasTask main.js:4439
t.hasTask polyfills.js:3
t._updateTaskCount polyfills.js:3
r._updateTaskCount polyfills.js:3
r.runTask polyfills.js:3
o