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.

36 lines
1.0 KiB

  1. 'use strict';
  2. angular.module('app.main', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/main', {
  5. templateUrl: 'views/main/main.html',
  6. controller: 'MainCtrl'
  7. });
  8. }])
  9. .controller('MainCtrl', function($scope, $http) {
  10. $scope.users = [];
  11. $scope.travels = [];
  12. $scope.loadMorePagination = true;
  13. $scope.page = 0;
  14. $http.get(urlapi + 'users?page=' + $scope.page)
  15. .then(function(data) {
  16. console.log('data success');
  17. console.log(data);
  18. $scope.users = data.data;
  19. }, function(data) {
  20. console.log('data error');
  21. });
  22. $http.get(urlapi + 'travels?page=' + $scope.page)
  23. .then(function(data) {
  24. console.log('data success');
  25. console.log(data);
  26. $scope.travels = data.data;
  27. }, function(data) {
  28. console.log('data error');
  29. });
  30. });