Desktop markdown wiki app. Built with node, Electron Framework and AngularJS.

sidebar-ctrl.js 945B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @ngdoc function
  3. * @name domainManagerApp.controller:AboutCtrl
  4. * @description
  5. * # AboutCtrl
  6. * Controller of the domainManagerApp
  7. */
  8. angular.module('codexApp.sidebar', [])
  9. .controller('SidebarCtrl',['$scope', '$rootScope', '$state', function ($scope, $rootScope, $state) {
  10. console.log('-> Sidebar loaded')
  11. $scope.showSidebar = true;
  12. $scope.goToAllNotes = function() {
  13. $rootScope.$broadcast('main-window:note-list');
  14. $rootScope.$broadcast('window-view:change');
  15. $state.go("index");
  16. }
  17. $rootScope.$on('sidebar:toogle', function() {
  18. if(!$scope.$$phase) {
  19. $scope.$apply(function(){
  20. $scope.toogleSidebar();
  21. });
  22. } else {
  23. $scope.toogleSidebar();
  24. }
  25. });
  26. $scope.toogleSidebar = function() {
  27. if( $scope.showSidebar == true){
  28. $scope.showSidebar = false;
  29. } else {
  30. $scope.showSidebar = true;
  31. }
  32. }
  33. }]);