Source: directives/scroller/scroller.js

/**
 * @ngdoc directives
 * @name Scroller
 * @module s4c.directives.scroller.Scroller
 *
 * @description
 * `Scroller` Controller da funcionalidade 
 * 
 * 
 */
'use strict';

angular.module('s4c.directives.scroller', [])
    .directive('scroller', scroller).directive('horario', horarioCtrl);

function scroller() {
    return {
        restrict: 'E',
        templateUrl: 'app/directives/scroller/scroller.html',
        scope: {},
        controller: [
            '$scope',
            '$rootScope',
            '$http',
            'API_ENDPOINT',
            '$timeout',
            '$interval',

            function ($scope, $rootScope, $http, API_ENDPOINT, $timeout, $interval) {

                $scope.scrollers;
                $scope.loadScroller = function () {

                    if (window.aberto) {
                        $http.get(API_ENDPOINT + 'scroller/feed/').then(function (data) {
                            $scope.scrollers = data.data;
                        });
                    }

                    $timeout($scope.loadScroller, 60000);
                };

                $scope.loadScroller();
            }

        ],
        link: function ($scope, $elem, $attrs) {
        }
    };
}

/**
 * @method horarioCtrl
 * @param {*} $interval 
 */
function horarioCtrl($interval) {
    return {
        restrict: 'EA',
        replace: true,
        template: '<div>{{horario}}</div>',
        controller: function ($scope) {

            $interval(function () {
                $scope.horario = moment().format('HH:mm');
            }, 60000);

        },
        link: function () {
        }
    }
}
horarioCtrl.$inject = ['$interval'];