I
I
Ivan Damaskin2015-04-08 17:49:34
JavaScript
Ivan Damaskin, 2015-04-08 17:49:34

How to extract value from json object using AngularJS?

Hello everyone, I have this json object:

[
  {
    "id": "0",
    "date": "07.04.2015",
    "category": [
      {
        "catId": 0,
        "catName": "Магазин"
      }
    ],
    "title": [
      {
        "titleId": 0,
        "titleName": "Пятерочка",
        "imageUrl": "0.jpg",
        "raiting": 5
      }
    ]   
  }
]

I make a get request in the controller:
$http.get('objects/list.json').success(function(data){
        $scope.list = data;
})

Now I want to output elements like: date and titleName
I can do it with ng-repeat, but is there any other way? And how to get to the titleName element in an object for example?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2015-04-08
Antonikhin @STJ

list[0].date
list[0].titleName

N
Nikita, 2015-04-08
@jetu

20091116-so-large.gif

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question