1

I have in my .html:

{{data}}

It will display:

[ { "images" : [ { "__v" : 0,
          "_id" : "542e57a709d2d60000c93953",
          "name" : "image1",
          "url" : "http://www.syll.com"
        },
        { "__v" : 0,
          "_id" : "543249050fcae2f082ca3e70",
          "name" : "imageOCR1",
          "url_image" : "http://meta-e.aib.uni-linz.ac.at/ocr.gif"
        },
        { "__v" : 0,
          "_id" : "543249050fcae2f082ca3e71",
          "name" : "imageOCR2",
          "url_image" : "http://www.textcreationpartnership.org/xxx.jpg"
        }
      ],
    "itemCount" : 70,
    "pageCount" : 7
  } ]

But I would like to display the value in "pageCount" so 7.

How I can do that without ng-repeat? btw, y controller works fine.

I tried:

{{data.pageCount}}

But it doesn't work.

Thanks!

[EDIT] changed with the righ JSON and formatted.

3
  • The data you are showing is incomplete. If there is a leading "[" there ought to be a trailing "]", too. It seems to me that you should read up on json/javascript literals. Probably for your case {{data[0].pageCount}} will work. Commented Oct 8, 2014 at 9:24
  • Sorry, wrong copy/paste. Just edited. Commented Oct 8, 2014 at 9:24
  • And please format your JSON so it's readable. Nobody wants to scroll horizontally to find the property you're interested in. Commented Oct 8, 2014 at 9:25

1 Answer 1

1

It looks like your data is all contained within a single-element array. Have you tried the following?

{{data[0].pageCount}}
Sign up to request clarification or add additional context in comments.

2 Comments

But when I do <button ng-disabled="currentPage >= {{data[0].pageCount}}" ng-click="getPage(currentPage=currentPage+1)"> it doesn't work
Really try to work through some tutorials and read code from others. ng-disabled already takes an angular expression, so there is no need for the double curlies: ng-disabled="currentPage >= data[0].pageCount"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.