小编kia*_*taj的帖子

如何将一些样式应用于角材料表中的表行

我有这张桌子:

    <div class="table-container">
    <table mat-table [dataSource]="dataSource">
        <mat-divider></mat-divider>

        <!-- title column -->
        <ng-container matColumnDef="title">
            <th mat-header-cell *matHeaderCellDef> {{ 'NOTIFYCATION.NOTIFY_TITLE' | translate }} </th>
            <td mat-cell *matCellDef="let element"> {{element.title}} </td>
        </ng-container>

        <!-- code column -->
        <ng-container matColumnDef="description">
            <th mat-header-cell *matHeaderCellDef> {{ 'NOTIFYCATION.DESCRIPTION'  | translate }} </th>
            <td mat-cell *matCellDef="let element"> {{element.description}} </td>
        </ng-container>
        <!-- code column -->
        <ng-container matColumnDef="receiverDisplayName">
            <th mat-header-cell *matHeaderCellDef> {{ 'NOTIFYCATION.RECEIVER_DISPLAY_NAME'| translate }} </th>
            <td mat-cell *matCellDef="let element"> {{element.receiverDisplayName}} </td>
        </ng-container>
        <!-- code column -->
        <ng-container matColumnDef="type">
            <th mat-header-cell …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular-material angular

6
推荐指数
1
解决办法
1万
查看次数

无法删除 [object Array] 的属性“1”

Input在我的组件中获取列表:

@Input() usersInput: Section[];

export interface Section {
    displayName: string;
    userId: number;
    title: number;
}
Run Code Online (Sandbox Code Playgroud)

这是值列表:

    0:
     displayName: "???? ???"
     firstName: null
     lastName: null
     title: 0
     userId: 1
   1:
     displayName: "???????? ????????"
     firstName: "????????"
     lastName: "????????"
     title: 0
     userId: 2
Run Code Online (Sandbox Code Playgroud)

ngAfterViewInit我将输入值设置为用户列表:

ngAfterViewInit(): void {
    this.users = this.usersInput;
    if (this.users.length === 0) {
        this.show = false;
    } else {
        this.show = true;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是用户:

users: Section[] = []; 我在 html 列表中使用它:

<div *ngFor="let item of users" class="d-flex …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular

6
推荐指数
3
解决办法
1万
查看次数