This is my first attempt to use the Angularjs and I'm trying to create a service and use it inside a controller:
var appTest = angular.module("appTest", ["ngRoute"]);
var appTestControllers = angular.module('appTestControllers', []);
appTest.config(['$routeProvider', '$locationProvider',
    function($routeProvider, $locationProvider) {
        $routeProvider.
            when('/', {
                templateUrl: 'partials/home.html',
                controller: 'HomeCtrl'
            });
            $locationProvider.html5Mode(false);
    }
]);
appTest.factory("booksApi", function($http){
    var _getBooks = function() {
        return $http.get('http://localhost/editora-voo/website/books.json');
    };
    return{
        getBooks: _getBooks
    };
});
appTest.controller('HomeCtrl', ['$scope', '$http', function($scope, $http, booksApi) {
    booksApi.getBooks().success(function(data) {
        $scope.books = data;
    });
}]);
But it is returning an error: Cannot read property 'getBooks' of undefined