Why isn't my Data being requested?


#1

Hi Ionic members,
I’m creating an application which requires me to get Json data from a HTTP url.

I cannot get the Data to load into my HTML pull to refresh form. I thought everything is correct but obviously not.

I’ve created a codepen here:

http://codepen.io/beefman/pen/aOpKgL

please can someone help. Thanks


#2

Your data is being requested just fine, and the HTTP response is

{"announcement_name":"ExampleMessage1","date":"26/05/2015","message":"ExampleMessage1"}

The problem is that by doing ng-repeat="data in data" you’re actually iterating over the properties of the object, so for the first item data will be the string annoucement_name.

You probably want to iterate over an array, not a single object.

I have a few videos that may help you get a better understanding of how to write and debug here: Ionic: Building a Feed Reader app


#3

Thank you, i used an array and everything is working now in codepen but when i copy and paste the code into my application it doesn’t work???