             if $scope.descending then "icon-chevron-down" else "icon-chevron-up"
 
           $scope.fromPage = () ->
-            if $scope[paginationName]
-              $scope[paginationName].fromPage()
-            else
-              $scope.list.length
+            if $scope[paginationName] then $scope[paginationName].fromPage() else $scope.list.length
 
           $scope.toPage = () ->
-            if $scope[paginationName]
-              $scope[paginationName].itemsPerPage
-            else
-              $scope.list.length
+            if $scope[paginationName] then $scope[paginationName].itemsPerPage else $scope.list.length
       }
   }
 ]

        $scope.stub.itemsPerPage * $scope.stub.currentPage - $scope.list.length

      $scope.goToPage = (page) ->
        if page < 0
          page = 0
        else if page > $scope.stub.numberOfPages - 1
          page = $scope.stub.numberOfPages - 1

        $scope.stub.currentPage = page

      $scope.update()

      $scope.instance = $scope.stub

      $scope.$watch "list", () ->
        $scope.update()
  }

    }
    link: ($scope, $element, $attributes) ->
      $scope.stub = {}
      $scope.instance = $scope.stub
      $scope.stub.list = $scope.list
      $scope.stub.itemsPerPage = $scope.itemsPerPage
      $scope.stub.currentPage = 0

      $scope.update = () ->
