|
@@ -1,5 +1,6 @@
|
|
(function(){
|
|
(function(){
|
|
app.controller('Authors', ['$scope', 'books.repository', '$routeParams','utils', function ($scope, booksRepository, $routeParams, utils){
|
|
app.controller('Authors', ['$scope', 'books.repository', '$routeParams','utils', function ($scope, booksRepository, $routeParams, utils){
|
|
|
|
+
|
|
booksRepository.getAuthors()
|
|
booksRepository.getAuthors()
|
|
.then(function(respons){
|
|
.then(function(respons){
|
|
$scope.authors = respons.data
|
|
$scope.authors = respons.data
|
|
@@ -8,20 +9,23 @@
|
|
message: error.statusText,
|
|
message: error.statusText,
|
|
type: 'danger'
|
|
type: 'danger'
|
|
})
|
|
})
|
|
- })
|
|
|
|
|
|
+ });
|
|
$scope.deleteAuthor = function(id){
|
|
$scope.deleteAuthor = function(id){
|
|
$scope.authors.splice($scope.authors.indexOf(id), 1)
|
|
$scope.authors.splice($scope.authors.indexOf(id), 1)
|
|
};
|
|
};
|
|
- // utils.notify({
|
|
|
|
- // message: 'her na lob',
|
|
|
|
- // type: 'danger'
|
|
|
|
- // })
|
|
|
|
$scope.user = {
|
|
$scope.user = {
|
|
name: 'awesome user'
|
|
name: 'awesome user'
|
|
};
|
|
};
|
|
$scope.updateUser = function(){
|
|
$scope.updateUser = function(){
|
|
console.log($scope.user)
|
|
console.log($scope.user)
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+ $scope.saveAuthor = function(data, author){
|
|
|
|
+ booksRepository.updateAuthorsById(data, author).then(function(respons){
|
|
|
|
+ utils.notify({
|
|
|
|
+ message: 'authors edite',
|
|
|
|
+ type: 'succes'
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ };
|
|
}])
|
|
}])
|
|
})();
|
|
})();
|