javascript - Getting a JSON response with ember -


i trying experimenting ember js. instead of fixtures use api.

this code using data:

app.itemsroute = ember.route.extend({     model: function() {         return $.getjson('http://someurl.json').then(function(data) {             return data.items_popular.map(function(item) {                 return item;             });         });     } }); 

this json file looks like:

{    "popular":{       "items_popular":[          {             "id":"23",             "item":"some title",             "url":"http://url",             "user":"girl"          },          {             "id":"56",             "item":"title of item 2",             "url":"http://url",             "user":"guy"          }       ]    } } 

currently keep getting

cannot call method 'map' of undefined  

would appreciate refactoring request

you're accessing data.items_popular, should data.popular.items_popular.

demo: http://jsfiddle.net/rmfrt/


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -