Source: directives/video/video.js

/**
 * @ngdoc directives
 * @name video
 * @module s4c.directives.video.video
 *
 * @description Componente para controle do módulo de Vídeo
 *
 *
 */
(function () {
    'use strict';

    videoController.$inject = [
        '$scope',
        'Preset',
        '$timeout',
        '$sce'
    ];

    function videoController(
        $scope,
        Preset, $timeout, $sce) {

        $scope.res = $scope.$root.res;
        $scope.link;

        var modulos = Preset.obter().PresetModulos;
        $scope.presetId = Preset.obter().id;

        $scope.videoDivId = Math.random().toString(36).substring(2, 15);
        $timeout(function () {
            for (var index in modulos) {
                if ((modulos[index].template == 'app/components/modulos/modulo-video.html' ||
                    (modulos[index].Face && modulos[index].Face.template == 'app/components/modulos/modulo-video.html')) && !modulos[index].usado) {

                    modulos[index].usado = true;
                    $scope.modulo = modulos[index];
                    $scope.link = $sce.trustAsResourceUrl(modulos[index].Face.extras[0].filePath);
                    break;
                }
            }
        }, 300);

        angular.extend($scope, {
        });
    }

    function s4cVideo() {
        return {
            restrict: 'EA',
            templateUrl: 'app/directives/video/video.html',
            scope: {},
            controller: videoController
        };
    }

    angular.module('s4c.components.video', [])
        .directive('s4cVideo', s4cVideo);
})();