[英]How can I make WebStorm recognize Angular Material syntax?
I'm using @angular/material with Angular 9. WebStorm doesn't recognize the @angular/material syntax:我将@angular/material与Angular 9 一起使用。WebStorm 无法识别@angular/material 语法:
It also doesn't recognize the correct type:它也无法识别正确的类型:
No custom shenanigans going on.没有自定义的恶作剧。 Everything is straight from their tutorials in a brand new angular project generated with the CLI.
一切都直接来自他们在使用 CLI 生成的全新 angular 项目中的教程。
The table declaration:表声明:
<table mat-table [dataSource]="dataSource" matSort class="mat-elevation-z8">
My TS file:我的 TS 文件:
export interface Property {
street: string;
zip: string;
city: string;
lat: number;
lng: number;
rooms: number;
area: number;
monthlyFee: number;
builtYear: number;
soldDate: string;
}
const ELEMENT_DATA: Property[] = [
{
street: 'Vasagatan 1',
zip: '11345',
city: 'Stockholm',
lat: 89.123912,
lng: 89.123912,
rooms: 3,
area: 87,
monthlyFee: 2450,
builtYear: 1989,
soldDate: '2020-04-30',
},
];
@Component({
selector: 'app-dataset-list',
templateUrl: './dataset-list.component.html',
styleUrls: ['./dataset-list.component.scss']
})
export class DatasetListComponent implements OnInit {
displayedColumns: string[] = ['street', 'zip', 'city', 'lat', 'lng', 'rooms', 'area', 'monthlyFee', 'builtYear', 'soldDate'];
dataSource = new MatTableDataSource(ELEMENT_DATA);
@ViewChild(MatSort, {static: true}) sort: MatSort;
ngOnInit() {
this.dataSource.sort = this.sort;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.