设置<a> tag within angular-ui bootstrap pagination module

时间:2015-08-25 20:52:04

标签: angularjs seo angular-ui angular-ui-bootstrap

for SEO purposes, I want to crawl my angular application to create html snapshots. Is there a way to set set the "href" attribute of the anchor tags of the pagination directive.

An ideal method would be to take a base URL as a parameter and append the page number:

"http://www.somesite.com/products/" + page

My current pagination directive implementation looks like this:

<pagination 
    total-items="grid.totalCount" 
    items-per-page="grid.pageSize"
    ng-model="grid.pageNumber" 
    force-ellipses="true" 
    max-size="7" 
    class="pagination-sm  hidden-xs hidden-sm" 
    rotate="false"
    boundary-links="true"
    first-text="1"
    last-text="{{ grid.pageCount }}"
    ng-class="{
        'remove-boundaries': grid.pageCount <= 7, 
        'remove-first-boundaries': grid.pageNumber <= 7, 
        'remove-last-boundaries': grid.pageNumber >= grid.pageCount - 7 
}">
</pagination>

1 个答案:

答案 0 :(得分:2)

您可以尝试扩展指令(装饰它,示例here)并覆盖click事件以执行对服务器的请求。

编辑: 类似的东西:

app.config(function($provide) {
    $provide.decorator('paneDirective', function($delegate) {
        var directive = $delegate[0];
        angular.extend(directive.scope, {
            disabled:'@'
        });
        return $delegate;
    });
});

上面的示例扩展了pane指令,并向指令范围添加了一个属性'disabled。'