Created
March 20, 2015 11:26
-
-
Save 0xae/a278be628b9a64fc8972 to your computer and use it in GitHub Desktop.
Revisions
-
0xae created this gist
Mar 20, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ app.controller("AlojamentoCtrl", function ($q, $scope, $localForage, $stateParams){ $scope.alojamentos = []; var id = $stateParams.idEdificio; $scope.edificio = id; $localForage.keys().then( function (chaves){ var prefixo = "RGA::alojamento::" + id + "."; var ary = []; for (var i = 0; i < chaves.length; i++) { var chave = chaves[i]; if(chave.indexOf(prefixo) != -1){ ary.push($localForage.getItem(chave).then(function (section){ return section; })); console.log(chave); } }; $q.all(ary).then(function (data){ $scope.alojamentos = data; }); } ); });