"use strict"; /** * Created by ygowtham on 6/16/2015. */ (function () { 'use strict'; angular.module('myitsmApp') .directive('alertCarousel', [function () { return { restrict: 'E', replace: true, templateUrl: 'views/common/alert-carousel.html', scope: { basicData: '=', alertDetails: '=', collisions: '=', impactAnalysisStatus: "=" }, link: function init(scope) { scope.alertIndex = 0; scope.showAlerts = false; scope.$watch('alertDetails.alertItems', function () { while (scope.alertIndex >= scope.alertDetails.alertItems.length) { scope.alertIndex--; } }); scope.nextAlert = function () { if (scope.alertIndex < scope.alertDetails.alertItems.length - 1) { scope.alertIndex++; } }; scope.prevAlert = function () { if (scope.alertIndex > 0) { scope.alertIndex--; } }; } }; }]); }());