小编Aka*_*ash的帖子

我在我的 angular 应用程序中使用了 ngb 分页,但它无法正常工作

我已经在表格中的 angular 应用程序上应用了 NGB 分页,但它不起作用。它只是显示 2 页,而不是在表的页面之间划分数据。我的代码如下:

import { UserService } from './../services/user.service';
import { Component, OnInit } from '@angular/core';
import { UserInfo } from 'src/app/models/user-info';

@Component({
  selector: 'app-user',
  templateUrl: './user.component.html',
  styleUrls: ['./user.component.scss']
})
export class UserComponent implements OnInit {

  constructor(private _userService:UserService) { }

  ngOnInit() {
    this.getUserData();

  }


userData=[
{"name":"Akash","email":"akash@gmmail.com"},
{"name":"sumit","email":"sumit@gmmail.com"},
{"name":"mohit","email":"mohit@gmmail.com"},
{"name":"rajesh","email":"rajesh@gmmail.com"},
{"name":"ramesh","email":"ramesh@gmmail.com"},
{"name":"vikas","email":"vikas@gmmail.com"},
{"name":"suresh","email":"suresh@gmmail.com"},
{"name":"ramesh","email":"ramesh@gmmail.com"},
];

elementPerpage:number=5;
currentPage:number=1;
arrayLength:number=this.userData.length;
  userInfo:UserInfo[];
Run Code Online (Sandbox Code Playgroud)

这是我的 Html 文件

<h3>User Details</h3>
<div class="table-responsive">
    <table class="table table-striped ">
        <thead>
            <tr>
                <th scope="col">User Name</th>
                <th scope="col">User …
Run Code Online (Sandbox Code Playgroud)

bootstrap-modal bootstrap-4 angular

5
推荐指数
1
解决办法
1519
查看次数

标签 统计

angular ×1

bootstrap-4 ×1

bootstrap-modal ×1