(function(){ app.controller('Authors', ['$scope', 'books.repository', '$routeParams', function ($scope, booksRepository, $routeParams){ booksRepository.getAuthors() .then(function(respons){ $scope.authors = respons.data }) $scope.deleteAuthor = function(id){ $scope.authors.splice($scope.authors.indexOf(id), 1) } }]) })();