Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pagination 页面更改事件在ng2引导中不起作用_Pagination_Angular_Ng2 Bootstrap - Fatal编程技术网

Pagination 页面更改事件在ng2引导中不起作用

Pagination 页面更改事件在ng2引导中不起作用,pagination,angular,ng2-bootstrap,Pagination,Angular,Ng2 Bootstrap,我正试图用ng2引导程序在我的angular2应用程序中实现分页。我在跟踪 我的app.html <div> <div class="col-lg-12 text-right"> <pagination [totalItems]="bigTotalItems" (page-changed)="pageChanged($event)" [(ngModel)]="bigCurrentPage" [maxSize]="maxSize"

我正试图用ng2引导程序在我的angular2应用程序中实现分页。我在跟踪

我的app.html

<div>
    <div class="col-lg-12 text-right">
        <pagination [totalItems]="bigTotalItems" (page-changed)="pageChanged($event)" [(ngModel)]="bigCurrentPage" [maxSize]="maxSize"
        class="pagination-sm" [boundaryLinks]="true"></pagination>
    </div>
</div>
但是,当我更改分页页面时,它不会触发pagechanged事件。
请纠正我使它正常工作

输出称为pageChanged,而不是pageChanged

输出称为
pageChanged
,而不是
pageChanged
。哦,我感谢您的工作。您还可以使用规范语法,即
on page changed=“pageChanged($event)”
import { Component, View, Inject} from 'angular2/core';
import { CORE_DIRECTIVES } from 'angular2/common';
import { PAGINATION_COMPONENTS } from 'ng2-bootstrap/ng2-bootstrap';

// webpack html imports
@View({
    templateUrl: '/scripts/src/components/demo/demo.html',
    directives: [PAGINATION_COMPONENTS, CORE_DIRECTIVES]
})
@Component({
    selector: 'tabs-demo',
})
export class DemoComponent {
    private totalItems: number = 64;
    private currentPage: number = 4;

    private maxSize: number = 5;
    private bigTotalItems: number = 175;
    private bigCurrentPage: number = 1;

    private setPage(pageNo: number): void {
        this.currentPage = pageNo;
    };

    private pageChanged(event: any): void {
        console.log('Page changed to: ' + event.page);
        console.log('Number items per page: ' + event.itemsPerPage);
    };
}