     scope: true
     compile: (element, attributes, transclude) ->
       setup = createSetup attributes
-      constructHeader(element)
+
+      thead = element.find "thead"
+      tds = element.find "td"
+      constructHeader(thead, tds) if thead[0]
+
       setup.compile(element, attributes, transclude)
       {
         post: ($scope, $element, $attributes) ->

          else
            []


      $scope.goToPage = (page) ->
        page = Math.max(0, page)
        page = Math.min($scope.numberOfPages - 1, page)

    tbody


  orderByExpression = "| orderBy:predicate:descending"
  limitToExpression = "| limitTo:fromPage() | limitTo:toPage()"

  StandardSetup = (attributes) ->
    @repeatString = "item in #{attributes.list} #{orderByExpression}"
    @compile = (element, attributes, transclude) ->
      setupTr element, @repeatString

