Skip to content

Instantly share code, notes, and snippets.

@caionorder
Created October 31, 2016 13:03
Show Gist options
  • Save caionorder/1c77274c3f6850c636c954c4359e15ad to your computer and use it in GitHub Desktop.
Save caionorder/1c77274c3f6850c636c954c4359e15ad to your computer and use it in GitHub Desktop.
angular.module('starter.services', [])
.factory('Estrutura', function($http, $q) {
var json = $http.get('/json/process.json');
return {
all: function() {
return json;
},
tipo: function(info){
var lists = json,
list = [];
lists.then(function(dados){
for (var i = dados.data.length - 1; i >= 0; i--) {
if(dados.data[i].tipo == info){
list.push(dados.data[i]);
}
}
});
return list;
}
};
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment