stackviz/app/js/directives/timeline-details.js
Tim Buckley a22de1964c Add missing DI annotations and enable strictDi.
This adds missing `@ngInject` annotations to 2 directives and enables
angular's strictDi mode. This patch should fix bulids produced with
`gulp prod` that were unusable due to DI errors.

Change-Id: Ib3c8810c24afb3c859029d2f8eaf9044416b6fa3
2016-01-04 17:03:03 -07:00

49 lines
950 B
JavaScript

'use strict';
var directivesModule = require('./_index.js');
/**
* @ngInject
*/
function timelineDetails() {
/**
* @ngInject
*/
var controller = function($scope) {
$scope.item = null;
$scope.$watch('hoveredItem', function(value) {
if (value && !$scope.selectedItem) {
$scope.item = value;
} else if (!value && !$scope.selectedItem) {
$scope.item = null;
}
});
$scope.$watch('selectedItem', function(value) {
if (value) {
$scope.item = value;
} else {
if ($scope.hoveredItem) {
$scope.item = $scope.hoveredItem;
} else {
$scope.item = null;
}
}
});
};
return {
restrict: 'EA',
scope: {
'hoveredItem': '=',
'selectedItem': '='
},
controller: controller,
templateUrl: 'directives/timeline-details.html'
};
}
directivesModule.directive('timelineDetails', timelineDetails);