arnaucube
arnaucube/decentralized-blogging-platformPublic Self-hosted repository
decentralized-blogging-platform/webapp/views/main/main.js
webapp/views/main/main.jsRaw
 1'use strict';
 2
 3angular.module('app.main', ['ngRoute'])
 4
 5    .config(['$routeProvider', function($routeProvider) {
 6        $routeProvider.when('/main', {
 7            templateUrl: 'views/main/main.html',
 8            controller: 'MainCtrl'
 9        });
10    }])
11
12    .controller('MainCtrl', function($scope, $rootScope, $http) {
13
14
15      $scope.posts = {};
16      $http.get(apiurl + 'posts')
17          .then(function(data) {
18              console.log('data success');
19              console.log(data);
20              $scope.posts = data.data;
21          }, function(data) {
22              console.log('no user');
23          });
24
25    });