Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.51 KB | None | 0 0
  1. <body ng-controller="MirrorCtrl" ng-cloak>
  2. <div class="top">
  3. <div class="top-left">
  4. <!-- <div ng-include="'plugins/datetime/index.html'"></div>
  5. <div ng-include="'plugins/calendar/index.html'"></div> -->
  6. </div>
  7. <div class="top-right">
  8. <!-- <div ng-include="'plugins/weather/index.html'"></div>
  9. <div ng-include="'plugins/traffic/index.html'"></div>
  10. <div ng-include="'plugins/stock/index.html'"></div>
  11. <div ng-include="'plugins/tvshows/index.html'"></div>
  12. <div ng-include="'plugins/ha-display/index.html'"></div> -->
  13. </div>
  14. </div>
  15. ...
  16. ...
  17. <script src="filename.service"/>
  18. <script src= filename.controller"/>
  19. </body>
  20.  
  21. <ul ng-controller="Calendar" class="calendar fade" ng-show="focus == 'default'" ng-class="config.calendar.showCalendarNames ? 'show-calendar-names' : ''">
  22. <li class="event" ng-repeat="event in calendar" ng-class="(calendar[$index - 1].label != event.label) ? 'day-marker' : ''">
  23. <div class="event-details">
  24. <span class="day">
  25. <span ng-bind="event.startName"></span>
  26. <span ng-if="event.startName != event.endName"> - <span ng-bind="event.endName"></span></span>
  27. </span>
  28. <div class="details calendar-name" ng-bind="event.calendarName"></div>
  29. <span class="summary" ng-bind="event.SUMMARY"></span>
  30. <div class="details" ng-if="event.start.format('LT') != event.end.format('LT')">
  31. <span ng-if="event.startName != event.endName"><span ng-bind="event.start.format('M/D')"></span> <span ng-bind="event.start.format('LT')"></span> - <span ng-bind="event.end.format('M/D')"></span> <span ng-bind="event.end.format('LT')"></span></span>
  32. <span ng-if="event.startName == event.endName"><span ng-bind="event.start.format('LT')"></span> - <span ng-bind="event.end.format('LT')"></span></span>
  33. </div>
  34. <div class="details" ng-if="event.start.format('LT') == event.end.format('LT')">All day</div>
  35. </div>
  36. </li>
  37. </ul>
  38.  
  39. function Calendar($scope, $http, $interval, CalendarService) {
  40.  
  41. var getCalendar = function(){
  42. CalendarService.getCalendarEvents().then(function () {
  43. $scope.calendar = CalendarService.getFutureEvents();
  44. }, function (error) {
  45. console.log(error);
  46. });
  47. }
  48.  
  49. getCalendar();
  50. $interval(getCalendar, config.calendar.refreshInterval * 60000 || 1800000)
  51. }
  52. console.log("registering calendar controller")
  53. angular.module('SmartMirror')
  54. .controller('Calendar', Calendar);
  55.  
  56. (function () {
  57. 'use strict';
  58.  
  59. function CalendarService($window, $http, $q) {
  60. ...
  61. ...
  62. return service;
  63. }
  64. console.log("registering calendar service")
  65. angular.module('SmartMirror')
  66. .factory('CalendarService', CalendarService);
  67.  
  68. } ());
  69.  
  70. <div ng-include src="filename.html"></div>
  71.  
  72. <script src="filename.service" >
  73.  
  74. <script src="filename.controller">
  75.  
  76. <divinc src="filename.service"></divinc>
  77.  
  78. var templateGoesHere = angular.element(document.getElementById(element['id']));
  79. templateGoesHere.html(html);
  80. //document.body.innerHTML='';
  81. var v= $compile(templateGoesHere);
  82. //scope.$apply();
  83. return function linkFn(scope) {
  84. v(scope) // Link compiled element to scope
  85. }
  86. }
  87. }
  88. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement