 'use strict'
 
 class DomainsCtrl
-  constructor: (@scope, @window, @interval, @DomainsFcty, @MostCommonViolationsFcty, @WebSocketFcty) ->
+  constructor: (@scope, @window, @interval, @DomainsFcty, @MostCommonViolationsFcty, @WebSocketFcty, @NamedRouteService) ->
     @domainsVisible = false
     @groupsVisible = true
     @mostFrequentVisible = false



angular.module('holmesApp')
  .controller 'DomainsCtrl', ($scope, $window, $interval, DomainsFcty, MostCommonViolationsFcty, WebSocketFcty) ->

    $scope.model = new DomainsCtrl($scope, $window, $interval, DomainsFcty, MostCommonViolationsFcty, WebSocketFcty)


    @scope.$on '$destroy', @_cleanUp

    @_scrollToViolations() if @scope.$parent.prevHash == @NamedRouteService.reverse('violations')

  _scrollToElement: (el) =>
    srcollY = el[0].offsetTop + parseInt(el.css('margin-top'), 10) / 2
