You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.2 KiB

  1. angular.module('starter.controllers', [])
  2. .controller('AppCtrl', function($scope, $ionicModal, $timeout) {
  3. // With the new view caching in Ionic, Controllers are only called
  4. // when they are recreated or on app start, instead of every page change.
  5. // To listen for when this page is active (for example, to refresh data),
  6. // listen for the $ionicView.enter event:
  7. //$scope.$on('$ionicView.enter', function(e) {
  8. //});
  9. // Form data for the login modal
  10. $scope.loginData = {};
  11. // Create the login modal that we will use later
  12. $ionicModal.fromTemplateUrl('templates/login.html', {
  13. scope: $scope
  14. }).then(function(modal) {
  15. $scope.modal = modal;
  16. });
  17. // Triggered in the login modal to close it
  18. $scope.closeLogin = function() {
  19. $scope.modal.hide();
  20. };
  21. // Open the login modal
  22. $scope.login = function() {
  23. $scope.modal.show();
  24. };
  25. // Perform the login action when the user submits the login form
  26. $scope.doLogin = function() {
  27. console.log('Doing login', $scope.loginData);
  28. // Simulate a login delay. Remove this and replace with your login
  29. // code if using a login system
  30. $timeout(function() {
  31. $scope.closeLogin();
  32. }, 1000);
  33. };
  34. })
  35. .controller('TravelsCtrl', function($scope) {
  36. $scope.travels = [
  37. { id: 1, title: 'Travel1', description: "description for travel 1", owner: "user1", icon: "car" },
  38. { id: 2, title: 'Travel2', description: "description for travel 2", owner: "user2", icon: "station-wagon" },
  39. { id: 3, title: 'Travel3', description: "description for travel 3", owner: "user3", icon: "van" },
  40. { id: 4, title: 'Travel4', description: "description for travel 4", owner: "user1", icon: "station-wagon" },
  41. { id: 5, title: 'Travel5', description: "description for travel 5", owner: "user2", icon: "minivan" },
  42. { id: 6, title: 'Travel6', description: "description for travel 6", owner: "user3", icon: "lorry" },
  43. { id: 7, title: 'Travel7', description: "description for travel 7", owner: "user1", icon: "sport-car" },
  44. { id: 8, title: 'Travel8', description: "description for travel 8", owner: "user2", icon: "jeep" }
  45. ];
  46. })
  47. .controller('TravelCtrl', function($scope, $stateParams) {
  48. //$scope.travel=travels.get($stateParams.travelId);
  49. });