Advertisement
Guest User

list.js

a guest
Aug 25th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. /**
  2. * Created by osbox on 21.07.2016.
  3. */
  4. angular.module('social-media-monitor').component('list', {
  5. templateUrl: 'app/directives/header/FaTwLi/list.html',
  6. controller: function ($location, $rootScope, FollowersService, GraphicsService, FiltersService, PostService) {
  7.  
  8. var $ctrl = this;
  9.  
  10. $ctrl.getFacebookFollowers = FollowersService.getFollowersCountForFacebook;
  11.  
  12. $ctrl.getTwitterFollowers = FollowersService.getFollowersCountForTwitter;
  13.  
  14. $ctrl.getLinkedInFollowers = FollowersService.getFollowersCountForLinkedIn;
  15.  
  16. var currentDate = new Date();
  17.  
  18. $ctrl.getQuery = FiltersService.getQuery;
  19.  
  20. $ctrl.getQuery().endDate = currentDate;
  21.  
  22. $ctrl.getQuery().startDate = currentDate;
  23.  
  24. $ctrl.refresh = function () {
  25. console.log('Refreshing filters');
  26. if ($location.path() === '/posts') {
  27. PostService.refresh();
  28. }
  29. if ($location.path() === '/statistics') {
  30. GraphicsService.refresh();
  31. }
  32. };
  33.  
  34. $ctrl.now = function () {
  35. return currentDate;
  36. };
  37.  
  38.  
  39. $ctrl.getDate = function () {
  40.  
  41. return _maxDate;
  42. };
  43.  
  44. /*
  45. Broadcasts to all application that data should be updated.
  46. */
  47. $ctrl.refreshAll = function () {
  48. console.log('Broadcasting refresh all message.');
  49. $rootScope.$broadcast('smmt:refreshAll');
  50. // TODO check if $state.reload() works as expected when other page functionalities are implemented
  51. };
  52. }
  53. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement