12345678910111213141516171819202122232425262728 |
- (function() {
- 'use strict';
- app.controller('Header', headerController);
- function headerController($scope, booksRepository, $location, $rootScope, utils) {
-
- $scope.isLogged = function() {
- return localStorage.getItem('authToken') ? true : false;
- };
- $scope.search = function() {
- booksRepository.searchBy($scope.searchString).then(function(response) {
- sessionStorage.setItem('searchResult', JSON.stringify(response.data));
- $location.path('/books');
- $rootScope.$broadcast('searchEvent', response.data);
- }, function(error) {});
- }
- }
- headerController.$inject = [
- '$scope',
- 'books.repository',
- '$location',
- '$rootScope',
- 'utils'
- ];
- })();
|