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.

34 lines
1.2 KiB

  1. 'use strict';
  2. angular.module('app.user', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/user/:userid', {
  5. templateUrl: 'views/user/user.html',
  6. controller: 'UserCtrl'
  7. });
  8. }])
  9. .controller('UserCtrl', function($scope, $http, $routeParams) {
  10. $scope.user = {};
  11. $scope.likes = {};
  12. $http.get(urlapi + 'users/id/' + $routeParams.userid)
  13. .then(function(data, status, headers, config) {
  14. console.log('data success');
  15. console.log(data);
  16. $scope.user = data.data;
  17. }, function(data, status, headers, config) {
  18. console.log('data error');
  19. });
  20. $http.get(urlapi + 'users/id/likes/' + $routeParams.userid)
  21. .then(function(data, status, headers, config) {
  22. console.log('data success');
  23. console.log(data);
  24. $scope.likes = data.data;
  25. $scope.$broadcast('scroll.refreshComplete'); //refresher stop
  26. }, function(data, status, headers, config) {
  27. console.log('data error');
  28. $scope.$broadcast('scroll.refreshComplete'); //refresher stop
  29. });
  30. });