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.

25 lines
625 B

  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, $rootScope, $http) {
  10. $scope.posts = [];
  11. $http.get(apiurl + 'posts')
  12. .then(function(data) {
  13. console.log('data success');
  14. console.log(data);
  15. $scope.posts = data.data;
  16. }, function(data) {
  17. console.log('no user');
  18. });
  19. });