简体   繁体   English

材质图标显示难看

[英]material icon displays ugly

I am trying to follow to use angular material icon for my angular data table.I follow this toturial for my angualar data table.我正在尝试为我的 angular 数据表使用 angular 材料图标。我按照这个 toturial 为我的角度数据表。 I see the same code displays a beautiful icon in his screen whereas I get an ugly icon on my screen,我看到相同的代码在他的屏幕上显示一个漂亮的图标,而我在我的屏幕上看到一个丑陋的图标,

here is my code.这是我的代码。

datatable css file code.数据表 css 文件代码。

.full-width-table {
  width: 100%;
}

datatable component html file code.数据表组件 html 文件代码。

.....
.....
<ng-container matColumnDef="actions">
      <mat-header-cell *matHeaderCellDef></mat-header-cell>
      <mat-cell *matCellDef="let row">
        <button mat-icon-button><mat-icon>launch</mat-icon></button>
        <!-- <button mat-icon-button color="warn"><mat-icon>delete_outline</mat-icon></button> -->
      </mat-cell>
    </ng-container>
....
....

my appModule file我的应用模块文件

@NgModule({
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    AppRoutingModule,
    AppAsideModule,
    AppBreadcrumbModule.forRoot(),
    AppFooterModule,
    AppHeaderModule,
    AppSidebarModule,
    PerfectScrollbarModule,
    BsDropdownModule.forRoot(),
    TabsModule.forRoot(),
    ChartsModule,
    SelectDropDownModule,
    FormsModule,
    ReactiveFormsModule,
    CommonModule,
    CollapseModule,
    HttpClientModule,
    MatTableModule,
    MatPaginatorModule,
    MatSortModule,
    MatIconModule
],...

I have included this links in my index.html我已将此链接包含在我的索引中。html

<link rel="shortcut icon" href="assets/favicon.ico">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

why I get an ugly icon but my toturial instructor get beautiful icon with the same code.为什么我得到一个丑陋的图标,但我的教练却得到了具有相同代码的漂亮图标。 what things required to do in order to get the right one.为了得到正确的东西需要做些什么。 you may see what I get via attached picture.您可能会通过所附图片看到我得到的信息。

在此处输入图像描述

you must import import MatButtonModule on your appModule .您必须在 appModule 上导入import MatButtonModule appModule

Link to API reference链接到 API 参考

style.css or style.scss style.css 或 style.scss

@import "../node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css";

Index.html索引.html

<link href="https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Two+Tone|Material+Icons+Round|Material+Icons+Sharp" rel="stylesheet">

Import the above line and you can see the beautiful icon导入上面一行,就可以看到漂亮的图标了

<button mat-mini-fab color="warn" aria-label="">
    <mat-icon>filter_list</mat-icon>
</button>

Ref Url - https://material.angular.io/components/button/overview参考 Url - https://material.angular.io/components/button/overview

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM