Source: directives/hdmi/hdmi.js

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

    hdmiController.$inject = [
        '$scope',
        'Preset',
        'HdmiService'
    ];

    function hdmiController($scope,Preset, HdmiService) {

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

        var modulos = Preset.obter().PresetModulos;
        $scope.presetId = Preset.obter().id;
        $scope.id = Math.random().toString(36);
        var inputDevices;

        for (var index in modulos) {
            if ((modulos[index].template == 'app/components/modulos/modulo-hdmi.html' ||
                (modulos[index].Face && modulos[index].Face.template == 'app/components/modulos/modulo-hdmi.html')) && !modulos[index].usado) {

                modulos[index].usado = true;
                $scope.modulo = modulos[index];
                inputDevices = $scope.modulo.Face.extras[0].devices;
                break;
            }
        }

        setTimeout(() => {
            HdmiService.attachDevice(document.getElementById($scope.id), inputDevices);
        }, 400);

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

    function s4cHdmi() {
        return {
            restrict: 'EA',
            templateUrl: 'app/directives/hdmi/hdmi.html',
            scope: {},
            controller: hdmiController
        };
    }

    angular.module('s4c.components.hdmi', [])
        .directive('s4cHdmi', s4cHdmi);
})();