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.

24 lines
756 B

  1. 'use strict';
  2. angular.module('app.post', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/post/:postid', {
  5. templateUrl: 'views/post/post.html',
  6. controller: 'PostCtrl'
  7. });
  8. }])
  9. .controller('PostCtrl', function($scope, $rootScope, $http, $routeParams) {
  10. $scope.post = {};
  11. $scope.user = {};
  12. $http.get(apiurl + 'post/' + $routeParams.postid)
  13. .then(function(data) {
  14. console.log('data success');
  15. console.log(data);
  16. $scope.post = data.data;
  17. $scope.user = $scope.post.user;
  18. }, function(data) {
  19. console.log('no user');
  20. });
  21. });