相关疑难解决方法(0)

Mat-table排序演示不起作用

我试图让mat-table排序在本地工作,虽然我可以按预期显示数据,但点击标题行不会像在线示例那样进行排序(根本不会发生任何事情).我试图让这个演示在本地工作:https : //material.angular.io/components/sort/overview https://plnkr.co/edit/XF5VxOSEBxMTd9Yb3ZLA?p=preview

我使用Angular CLI生成了一个新项目,然后按照以下步骤操作:https: //material.angular.io/guide/getting-started

这是我的本地文件:

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { MatSort, MatTableModule } from '@angular/material';

import { AppComponent } from './app.component';
import { TableSortingExample } from './table-sorting-example';

@NgModule({
  declarations: [
    AppComponent,
    TableSortingExample,
    MatSort
  ],
  imports: [
    BrowserModule,
    MatTableModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: …
Run Code Online (Sandbox Code Playgroud)

angular-material angular

78
推荐指数
16
解决办法
5万
查看次数

标签 统计

angular ×1

angular-material ×1