123456789101112131415161718192021222324252627282930313233343536373839 |
- (function(){
- 'use strict';
- app.controller('AddBook', addBookController);
- function addBookController($scope, $uibModalInstance, booksRepository){
- $scope.newBook = {
- title: '',
- author_id: null,
- date: "",
- cost: '',
- rate: '',
- intro: ''
- }
- booksRepository.getAuthors()
- .then(function(response){
- $scope.authors = response.data.map(function(author){
- return {
- id: author.id,
- name: author.firstname + ' ' + author.lastname
- }
- })
- });
- $scope.cancel = function(){
- $uibModalInstance.dismiss('cancel');
- // $uibModalInstance.close(false);
- };
- $scope.ok = function(){
- $uibModalInstance.close($scope.newBook);
- }
- }
-
- addBookController.$inject = [
- '$scope',
- '$uibModalInstance',
- 'books.repository',
- '$uibModalInstance'
- ];
- })()
|