|
@@ -1,6 +1,6 @@
|
|
|
(function() {
|
|
|
'use strict';
|
|
|
- app.controller('BooksList', function($scope){
|
|
|
+ app.controller('BooksList', ['$scope','books.repository',function($scope, booksRepository){
|
|
|
$scope.sortFild = 'title';
|
|
|
$scope.sortBy = function(field){
|
|
|
$scope.sortFild = ($scope.sortFild === field)? '-'+ field : field;
|
|
@@ -14,87 +14,11 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- $scope.books = [
|
|
|
- {
|
|
|
- title: 'Harry Potter',
|
|
|
- author: 'J. Rowling',
|
|
|
- date: '1998-01-01',
|
|
|
- cost: '300$',
|
|
|
- rate: '50',
|
|
|
- id: 1
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Terra Ucrainica',
|
|
|
- author: 'Д. Вортман',
|
|
|
- date: '1991-12-11',
|
|
|
- cost: '100$',
|
|
|
- rate: '4',
|
|
|
- id: 2
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Аеропорт',
|
|
|
- author: 'А. Гейлі',
|
|
|
- date: '2000-03-03',
|
|
|
- cost: '500$',
|
|
|
- rate: '3',
|
|
|
- id: 3
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Бог завжди подорожує інкогніто',
|
|
|
- author: 'Л. Гунель',
|
|
|
- date: '2001-10-12',
|
|
|
- cost: '200$',
|
|
|
- rate: '4',
|
|
|
- id: 4
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Джерело. Клубне видання',
|
|
|
- author: 'Д. Браун',
|
|
|
- date: '1999-10-11',
|
|
|
- cost: '500$',
|
|
|
- rate: '5',
|
|
|
- id: 5
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Вежа блазнів',
|
|
|
- author: 'А. Сапковський',
|
|
|
- date: '1993-04-02',
|
|
|
- cost: '400$',
|
|
|
- rate: '8',
|
|
|
- id: 6
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Ненавижу, потому что люблю',
|
|
|
- author: 'Н. Соболевская',
|
|
|
- date: '2011-10-03',
|
|
|
- cost: '100$',
|
|
|
- rate: '10',
|
|
|
- id: 7
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Крейдяна Людина',
|
|
|
- author: 'С. Дж. Тюдор',
|
|
|
- date: '1990-03-08',
|
|
|
- cost: '10$',
|
|
|
- rate: '2',
|
|
|
- id: 8
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Джерело. Суперобкладинка',
|
|
|
- author: 'Д. Браун',
|
|
|
- date: '2000-03-05',
|
|
|
- cost: '500$',
|
|
|
- rate: '20',
|
|
|
- id: 9
|
|
|
- },
|
|
|
- {
|
|
|
- title: 'Великий атлас світу',
|
|
|
- author: 'ред. О. Король',
|
|
|
- date: '1997-10-11',
|
|
|
- cost: '300$',
|
|
|
- rate: '5',
|
|
|
- id: 10
|
|
|
- },
|
|
|
- ]
|
|
|
- })
|
|
|
+
|
|
|
+ booksRepository.getBooks().then(function(response){
|
|
|
+ $scope.books = response.data;
|
|
|
+ }, function(error){
|
|
|
+
|
|
|
+ });
|
|
|
+ }])
|
|
|
})()
|