Created
October 31, 2016 13:03
-
-
Save caionorder/1c77274c3f6850c636c954c4359e15ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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