{"size": 1002, "ext": "js", "max_stars_repo_path": "client/app/scripts/controllers/home.js", "max_stars_repo_name": "gitter-badger/loopback-angular-admin", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "client/app/scripts/controllers/home.js", "max_issues_repo_name": "gitter-badger/loopback-angular-admin", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "client/app/scripts/controllers/home.js", "max_forks_repo_name": "gitter-badger/loopback-angular-admin", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.3191489362, "max_line_length": 79, "alphanum_fraction": 0.6007984032}
'use strict';

/**
 * @ngdoc function
 * @name loopbackApp.controller:HomeCtrl
 * @description
 * # HomeCtrl
 * Controller of the loopbackApp
 */
angular.module('loopbackApp')
  .config(function ($stateProvider) {
    $stateProvider.state('app.home', {
      url: '',
      templateUrl: 'views/home.html',
      controller: 'HomeCtrl'
    });
  })
  .controller('HomeCtrl', function ($scope, $http, Post, Product, Event, ENV) {

    $scope.count = {};

    Post.find(function (posts) {
      $scope.count.posts = posts.length;
    });

    Product.find(function (products) {
      $scope.count.products = products.length;
    });

    $scope.count.events = 0;
    $scope.count.files = 0;


    $http.get(ENV.apiUrl + '/containers/files/files').success(function (data) {
      $scope.count.files = data.length;
    });

    Event.find(function (events) {
      $scope.count.events = events.length;
    });

    // Post.find(function(posts){
    //   $scope.count.posts = posts.length;
    // });

  });
