我尝试在我的 Angular 应用程序中使用 p-table(PrimeNg 表),我从 CLI 导入了所有必要的依赖项并导入了模块文件,错误是,
目标入口点“primeng/table”中的错误缺少依赖项:-@angular/cdk/scrolling
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AccordionModule } from 'primeng/accordion'; //accordion and accordion tab
import { MenuItem } from 'primeng/api';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TableModule } from 'primeng/table';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, AppRoutingModule, AccordionModule,TableModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
我的 component.html 是:
<h1>Hello {{ title }}</h1>
<br />
<p-table [value]="detail">
<ng-template pTemplate="header">
<tr>
<th>Vin</th>
<th>Year</th>
<th>Brand</th>
<th>Color</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-car>
<tr>
<td>Aashiq</td>
<td>Aadhil</td>
<td>Zubair</td>
<td>Athaa</td>
</tr>
</ng-template>
</p-table>
我的 app.component.ts 是:
import { Component,OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
ngOnInit(): void {
throw new Error("Method not implemented.");
}
title = 'Angularprimeng';
detail:any;
}
萧十郎
茅侃侃
慕姐4208626
相关分类