0

Having the following in a json response :

[
   "alt_sizes":[
      {"width":500,"height":333,"url":"http://..."},  
      {"width":400,"height":266,"url":"http://..."},
      {"width":250,"height":167,"url":"http://..."},
      {"width":100,"height":67,"url":"http://..."},
      {"width":75,"height":75,"url":"http://..."}
   ]
]

I parse my object with somehow the following

obj.alt_sizes[0]

But what if I wanted to get with angular.js the element having a specific width or height ? Selecting the small one, having 75 for its width ?

1 Answer 1

1

You can use the filter filter to do this:

$filter('filter')($scope.items, {width:'75'})

Here is a plunker: http://plnkr.co/edit/mP3LLHgJSIEbe16HrO6f?p=preview

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.