Open In App

Angular PrimeNG Paginator Properties

Angular PrimeNG is an open-source framework with a rich set of native Angular UI components that are used for great styling and this framework is used to make responsive websites with very much ease. In this article, we will know how to use the Paginator Properties in Angular PrimeNG.

The Paginator Component is used to display the content in paged format. The properties of the paginator are listed below.



Syntax:

<p-paginator></p-paginator>

 



Paginator Properties:

Creating Angular application & module installation:

Step 1: Create an Angular application using the following command.

ng new appname

Step 2: After creating your project folder i.e. appname, move to it using the following command.

cd appname

Step 3: Install PrimeNG in your given directory.

npm install primeng --save
npm install primeicons --save

Project Structure: It will look like the following:

Project Structure

Example 1: In the below code, we will be using the above properties to demonstrate the use of the Paginator Properties.




<div style="text-align:center;">
    <h1 style="color:green;">GeeksforGeeks</h1>
    <h3>A computer science portal for geeks</h3>
    <h4>Angular PrimeNG Paginator Properties</h4>
    <p-paginator [rows]="5" [totalRecords]="10"></p-paginator>
</div>




import { Component } from '@angular/core';
import { PrimeNGConfig } from 'primeng/api';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    constructor(private primengConfig: PrimeNGConfig) { }
  
    ngOnInit() {
        this.primengConfig.ripple = true;
    }
}




import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from 
    '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { PaginatorModule } from 'primeng/paginator';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        PaginatorModule,
        FormsModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
  
export class AppModule { }

Output:

 

Example2: In the below code, we will be using the above properties to demonstrate the use of the Paginator Properties.




<div style="text-align:center;">
    <h1 style="color:green;">GeeksforGeeks</h1>
    <h3>A computer science portal for geeks</h3>
    <h4>Angular PrimeNG Paginator Properties</h4>
    <p-paginator [rows]="5" [totalRecords]="10" 
        showCurrentPageReport="true" 
        alwaysShow="true" 
        showFirstLastIcon="true"
        showJumpToPageDropdown="true">
    </p-paginator>
</div>




import { Component } from '@angular/core';
import { PrimeNGConfig } from 'primeng/api';
  
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})
export class AppComponent {
    constructor(private primengConfig: PrimeNGConfig) { }
  
    ngOnInit() {
        this.primengConfig.ripple = true;
    }
}




import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from 
    '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { PaginatorModule } from 'primeng/paginator';
  
@NgModule({
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        PaginatorModule,
        FormsModule
    ],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
  
export class AppModule { }

Output:

 


Article Tags :