eventman/angular_app/js/controllers.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-03-14 17:32:16 +01:00
'use strict';
/* Controllers */
2015-03-15 18:00:08 +01:00
var eventManControllers = angular.module('eventManControllers', []);
2015-03-14 17:32:16 +01:00
2015-03-15 18:00:08 +01:00
eventManControllers.controller('EventsListCtrl', ['$scope', '$http',
function ($scope, $http) {
$http.get('/events').success(function(data) {
$scope.events = data.events;
});
$scope.orderProp = 'begin-datetime';
}]
);
2015-03-15 23:05:59 +01:00
eventManControllers.controller('EventDetailsCtrl', ['$scope', '$http', '$routeParams',
function ($scope, $http, $routeParams) {
$http.get("/events/" + $routeParams.eventID).success(function(data) {
$scope.event = data.event;
});
}]
);
2015-03-15 18:00:08 +01:00
eventManControllers.controller('PersonsListCtrl', ['$scope', '$http',
2015-03-14 17:32:16 +01:00
function ($scope, $http) {
$http.get('/persons').success(function(data) {
$scope.persons = data.persons;
});
2015-03-15 18:00:08 +01:00
$scope.orderProp = 'name';
2015-03-14 17:32:16 +01:00
}]
);
2015-03-15 23:05:59 +01:00
eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$http', '$routeParams',
function ($scope, $http, $routeParams) {
$http.get("/persons/" + $routeParams.personID).success(function(data) {
$scope.person = data.person;
});
}]
);