I am trying to write an AngularJS Directive that helps me with pagination. I want the user to be able to see up to 5 numbered links (1, 2, 3, 4, 5) when searching for something. If there are more than 5 pages of results they will be able to click an arrow > and see links 6 - 10 and so on. 

This is what I have so far, note that I am not sure how to complete the 'element.attr' line:

```
var ReportsApp = angular.module('ReportsApp', []);

ReportsApp.directive('paginate', function () {
    return {
        restrict: 'A',
        transclude: true,
    scope: {
        page: '=page'
    },
    link: function (scope, element, attrs) {
        var page = scope.page;
        updatePage();

        function updatePage() {
            if (page <= 5) {
                for (page = 1; page <= 5; page++) {
                    element.attr('paginate')
                }
            }
        }
    }
}
});

```

The html is:

```
  <div id="pages">
    <a href="#" paginate page="p"></a>
  </div>

```