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

JSON from webserver - Please Help

$
0
0

@ancooor wrote:

Hi all,

I'm getting crazy from this morning.
I'm tring to get json from web server and display it in a master-detail pattern.

I don't know what I'm wrong.

This is the file bb.json

 {
    "id": 0,
    "name": "Ben Sparrow",
    "lastText": "You on your way?",
    "face": "img/ben.png"
  }

I used the base template (tabs) by replacing the var chats[] that contains some fake data with this:

// Might use a resource here that returns a JSON array

var chats =  $http.get('http://mywebsite/bb.json').then(function(response){
    data = response.data;
    console.log("aaaaaaaaaaaaaaaaaaaa" + data); //the data is correctly logged
    console.log("chats inizializz");
    return data;

  });

All the remaining functions of the service and the controller are not modified.

Nothing work. Please help me, what I can do? I'm unable to get it works.
Any helps or suggestion is appreciated.

I allow Acces-Control-Origin and from the Chrome Dev Tools I can see that the file bb.json is downloaded

Best Regards

Posts: 4

Participants: 2

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>