Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

sidebar.controller.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Created by robin on 11/1/15.
  3. */
  4. angular.module('app')
  5. .controller('SideBarController', ['$scope', '$state', 'DataShareBusiness',
  6. function($scope, $state, DataShareBusiness) {
  7. $scope.DataShareBusiness = DataShareBusiness;
  8. $scope.Search = {
  9. value: "",
  10. selected: null
  11. };
  12. $scope.getCurrentGroups = function()
  13. {
  14. if (DataShareBusiness.CurrentGroups.length != 0) {
  15. var e = DataShareBusiness.CurrentGroups[DataShareBusiness.CurrentGroups.length - 1];
  16. if (e.Groups == null || e.Groups.length == 0) {
  17. return e.Parent.Groups;
  18. }
  19. return e.Groups;
  20. }
  21. return DataShareBusiness.Groups;
  22. };
  23. $scope.search = function()
  24. {
  25. var groups = [];
  26. function searchRec(group)
  27. {
  28. if (group.Name.toLowerCase().indexOf($scope.Search.value.toLowerCase()) > -1) {
  29. groups.push(group);
  30. }
  31. if (group.Groups != null) {
  32. group.Groups.forEach(searchRec);
  33. }
  34. }
  35. DataShareBusiness.Groups.forEach(searchRec);
  36. return groups;
  37. };
  38. $scope.goTo = function(group)
  39. {
  40. if (group != null) {
  41. DataShareBusiness.setCurrentGroup(group);
  42. }
  43. };
  44. }]);