How to make Index Lookup from json data from http request


#1

Can someone can help me or explain me how can I make a index look up because from the demo app the data is stored localy …

how can i do this if my data is from http request … because i want to use the id to stateparams and bind the data…

sorry for noob question and for my english also


#2

try this:

.factory('PetService', function( $filter){
	{...}
	return {
		{...}
		get: function(petId){
			return $filter('filter')(pets, function (d) { if(d.id == petId)	return d.id == id; })[0];
		}
	}
}