(function(){ "use strict"; angular.module('raz') .component('resourceCardSection', { templateUrl: '/js/angular/resource-slider/resource-card-section.html', controller: 'resourceCardSection', bindings: { resource: '<', index: '@?' } }) .controller('resourceCardSection', ['popoutManagerService', function (popoutManagerService) { var ctrl = this; ctrl.popoverCtrl = null; ctrl.$onInit = function () { ctrl.popoverPosition = ctrl.getPopoutClass(); }; ctrl.setPopover = function (popoverCtrl) { ctrl.popoverCtrl = popoverCtrl; ctrl.popoverCtrl.onEnter = function () { if (!popoutManagerService.hasWorker()) { ctrl.popoverCtrl.cancelHoverTimer(); ctrl.popoverCtrl.applyOpen(); } }; }; ctrl.onOpenChanged = function (open) { if (!open) { //register no worker with service popoutManagerService.setWorker(null); } }; ctrl.getPopoutClass = function () { if (ctrl.index === "3" || ctrl.index === "4") { return "{ my: 'right top', at: 'left top', collision: 'fit none' }"; } else { return "{ my: 'left top', at: 'right top', collision: 'fit none' }"; } }; }]); })();