刚开始使用 VMWare Clarity - 很酷的项目!我已按照示例添加数据网格并绑定到用户列表,但出现此错误:
无法绑定到“clrDgField”,因为它不是“clr-dg-cell”的已知属性。1. 如果 'clr-dg-cell' 是一个 Angular 组件并且它有 'clrDgField' 输入,那么验证它是这个模块的一部分。
Html 模板如下所示:
<clr-datagrid>
<clr-dg-column>First Name</clr-dg-column>
<clr-dg-column>Last Name</clr-dg-column>
<clr-dg-column>EMail</clr-dg-column>
<clr-dg-column>Capture Date</clr-dg-column>
<clr-dg-row *clrDgItems="let user of users">
<clr-dg-cell [clrDgField]="'firstName'">{{user.firstName}}</clr-dg-cell>
<clr-dg-cell [clrDgField]="'lastName'">{{user.lastName}}</clr-dg-cell>
<clr-dg-cell [clrDgField]="'email'">{{user.email}}</clr-dg-cell>
<clr-dg-cell [clrDgField]="'createdDate'">{{user.createdDate | date}}</clr-dg-cell>
</clr-dg-row>
<clr-dg-footer>
{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}}
of {{pagination.totalItems}} users
<clr-dg-pagination #pagination [clrDgPageSize]="50"></clr-dg-pagination>
</clr-dg-footer>
</clr-datagrid>
组件如下所示:
import { Component, OnInit } from '@angular/core';
import { User } from '../types/user.type';
import { SecurityService } from '../services/security.service';
@Component({
selector: 'app-maintain-users-component',
templateUrl: './maintain.users.component.html'
})
export class MaintainUsersComponent implements OnInit {
public users: User[];
constructor(private securityService: SecurityService) {
}
ngOnInit(): void {
this.users = this.securityService.getUsers();
}
}
功能模块如下所示:
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { ClarityModule } from 'clarity-angular';
import { SecurityRoutingModule } from './routing/security.routing.module';
import { MaintainUsersComponent } from './components/maintain.users.component';
import { SecurityService } from './services/security.service';
@NgModule({
imports: [CommonModule, ClarityModule, SecurityRoutingModule],
declarations: [MaintainUsersComponent],
providers: [SecurityService],
})
export class SecurityModule { }
应用模块有这个:
imports: [
BrowserModule,
HttpClientModule,
ClarityModule.forRoot(),
不确定要添加什么来消除此错误?我认为它会从清晰度模块中获得所需的一切?谢谢。