Skip to content

Instantly share code, notes, and snippets.

@fellipeh
Last active December 10, 2015 12:19
Show Gist options
  • Save fellipeh/2b9f0791202663717c35 to your computer and use it in GitHub Desktop.
Save fellipeh/2b9f0791202663717c35 to your computer and use it in GitHub Desktop.
MyAppMobile.angular.controller('CategoriaPageController', ['$scope', '$http', '$window', 'InitService',
'CategoriaListService', 'ParametrosService',
function ($scope, $http, $window, InitService, CategoriaListService, ParametrosService) {
'use strict';
$scope.goURL = function (v_url) {
ParametrosService.parametros.nome = 'params';
ParametrosService.parametros.valor = 'cat=' + v_url;
console.log(ParametrosService.parametros);
$window.location.href = 'filtro.html';
};
$scope.onItemClicked = function (produto) {
DataService.produtoClicked(produto);
};
InitService.addEventListener('ready', function () {
console.log('Carregando lista de categorias...');
$scope.categorias_loaded = false;
CategoriaListService.getCategorias().then(function (result) {
console.log(result);
$scope.categorias = result.data;
$scope.categorias_loaded = true;
}, function (err) {
console.error(err);
});
});
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment