authors.controller.js 671 B

123456789101112131415161718192021
  1. (function(){
  2. app.controller('Authors', ['$scope', 'books.repository', '$routeParams','utils', function ($scope, booksRepository, $routeParams, utils){
  3. booksRepository.getAuthors()
  4. .then(function(respons){
  5. $scope.authors = respons.data
  6. },function(error){
  7. utils.notify({
  8. message: error.statusText,
  9. type: 'danger'
  10. })
  11. })
  12. $scope.deleteAuthor = function(id){
  13. $scope.authors.splice($scope.authors.indexOf(id), 1)
  14. };
  15. // utils.notify({
  16. // message: 'her na lob',
  17. // type: 'danger'
  18. // })
  19. }])
  20. })();