You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

  1. 'use strict';
  2. angular.module('app.navbar', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/navbar', {
  5. templateUrl: 'views/navbar/navbar.html',
  6. controller: 'NavbarCtrl'
  7. });
  8. }])
  9. .controller('NavbarCtrl', function($scope, $http, $routeParams, $location) {
  10. $scope.searchString = "";
  11. $scope.locationHash = $location.path();
  12. console.log($scope.locationHash);
  13. $scope.goBack = function() {
  14. console.log("goBack");
  15. window.history.back();
  16. };
  17. $scope.search = function() {
  18. console.log($scope.searchString);
  19. window.location.href = "#!/search/" + $scope.searchString;
  20. };
  21. if (localStorage.getItem("cic_admin_userdata")) {
  22. $scope.storageuser = JSON.parse(localStorage.getItem("cic_admin_userdata"));
  23. console.log($scope.storageuser);
  24. }
  25. $scope.logout = function() {
  26. localStorage.removeItem("cic_admin_token");
  27. localStorage.removeItem("cic_admin_userdata");
  28. window.location.reload();
  29. };
  30. });