controllers.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. /* Controllers */
  3. var eventManControllers = angular.module('eventManControllers', []);
  4. eventManControllers.controller('EventsListCtrl', ['$scope', '$http',
  5. function ($scope, $http) {
  6. $http.get('/events').success(function(data) {
  7. $scope.events = data.events;
  8. });
  9. $scope.orderProp = 'begin-datetime';
  10. }]
  11. );
  12. eventManControllers.controller('EventDetailsCtrl', ['$scope', '$http', '$routeParams',
  13. function ($scope, $http, $routeParams) {
  14. $http.get("/events/" + $routeParams.eventID).success(function(data) {
  15. $scope.event = data.event;
  16. });
  17. }]
  18. );
  19. eventManControllers.controller('PersonsListCtrl', ['$scope', '$http',
  20. function ($scope, $http) {
  21. $http.get('/persons').success(function(data) {
  22. $scope.persons = data.persons;
  23. });
  24. $scope.orderProp = 'name';
  25. }]
  26. );
  27. eventManControllers.controller('PersonDetailsCtrl', ['$scope', '$http', '$routeParams',
  28. function ($scope, $http, $routeParams) {
  29. $http.get("/persons/" + $routeParams.personID).success(function(data) {
  30. $scope.person = data.person;
  31. });
  32. }]
  33. );