mirror of
https://github.com/arnaucube/openEventsPlatformApp.git
synced 2026-02-07 03:36:44 +01:00
implemented get events by categories
This commit is contained in:
@@ -13,7 +13,8 @@ angular.module('app', [
|
||||
'app.event',
|
||||
'app.alerts',
|
||||
'app.savedEvents',
|
||||
'app.byCategories',
|
||||
'app.categories',
|
||||
'app.byCategory',
|
||||
'app.users',
|
||||
'app.user',
|
||||
'app.login',
|
||||
@@ -93,12 +94,21 @@ angular.module('app', [
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('app.byCategories', {
|
||||
url: '/byCategories',
|
||||
.state('app.categories', {
|
||||
url: '/categories',
|
||||
views: {
|
||||
'menuContent': {
|
||||
templateUrl: 'templates/byCategories.html',
|
||||
controller: 'ByCategoriesCtrl'
|
||||
templateUrl: 'templates/categories.html',
|
||||
controller: 'CategoriesCtrl'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('app.byCategory', {
|
||||
url: '/byCategory/:categoryname',
|
||||
views: {
|
||||
'menuContent': {
|
||||
templateUrl: 'templates/byCategory.html',
|
||||
controller: 'ByCategoryCtrl'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
angular.module('app.byCategories', ['pascalprecht.translate'])
|
||||
|
||||
.controller('ByCategoriesCtrl', function($scope, $http, $ionicModal,
|
||||
$timeout, $ionicLoading, $filter) {
|
||||
angular.module('app.byCategory', ['pascalprecht.translate'])
|
||||
|
||||
.controller('ByCategoryCtrl', function($scope, $http, $ionicModal,
|
||||
$timeout, $ionicLoading, $filter, $stateParams) {
|
||||
|
||||
$scope.category=$stateParams.categoryname;
|
||||
$scope.events=[];
|
||||
$scope.alerts=[];
|
||||
$scope.page=0;
|
||||
$scope.doRefresh = function() {
|
||||
/* events refresh: */
|
||||
//$http.get(urlapi + 'events?page=' + $scope.page)
|
||||
$http.get(urlapi + 'events')
|
||||
$http.get(urlapi + 'events/category/'+ $stateParams.categoryname)
|
||||
.then(function(data){
|
||||
console.log('data success events');
|
||||
console.log(data); // for browser console
|
||||
//$scope.events = data.data; // for UI
|
||||
$scope.events=data.data;
|
||||
console.log($scope.events);
|
||||
$scope.$broadcast('scroll.refreshComplete');//refresher stop
|
||||
|
||||
}, function(data){
|
||||
@@ -24,11 +21,6 @@ angular.module('app.byCategories', ['pascalprecht.translate'])
|
||||
$ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
|
||||
|
||||
});
|
||||
$http.get(urlapi + 'alerts')
|
||||
.then(function(data){
|
||||
$scope.alerts=data.data;
|
||||
}, function(data){
|
||||
});
|
||||
};
|
||||
$scope.doRefresh();
|
||||
|
||||
@@ -49,8 +41,6 @@ angular.module('app.byCategories', ['pascalprecht.translate'])
|
||||
$scope.$on('$ionicView.enter', function(){//per executar-ho cada cop que es carrega el view
|
||||
if (localStorage.getItem("events_app_savedEvents")) {
|
||||
$scope.savedEvents = JSON.parse(localStorage.getItem("events_app_savedEvents"));
|
||||
console.log("savedEvents");
|
||||
console.log($scope.savedEvents);
|
||||
}
|
||||
});
|
||||
$scope.saveEvent = function(event){
|
||||
17
www/js/categories.js
Normal file
17
www/js/categories.js
Normal file
@@ -0,0 +1,17 @@
|
||||
angular.module('app.categories', ['pascalprecht.translate'])
|
||||
|
||||
.controller('CategoriesCtrl', function($scope, $http, $ionicModal, $timeout, $ionicLoading, $filter) {
|
||||
|
||||
|
||||
$scope.categories;
|
||||
$http.get(urlapi + 'categoriesList')
|
||||
.then(function(data){
|
||||
$scope.categories=data.data;
|
||||
console.log($scope.categories);
|
||||
}, function(data){
|
||||
console.log('data error');
|
||||
console.log(data);
|
||||
$ionicLoading.show({ template: 'Error connecting server', noBackdrop: true, duration: 2000 });
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user