md-icon md-list-icon未显示在角度2中

时间:2017-10-04 10:32:54

标签: angular2-forms

我想在我使用过的列表之前显示一个图标。

不确定Angular2是否支持以下内容。

以下模块'MaterialModule'我不需要,因为删除它后对我有效。

如果我导入这个模块,我得到:没有导出'MaterialModule'!

app.module.ts //不需要在此处导入

import {MaterialModule} from '@angular/material';

imports: [
   MaterialModule
...

的index.html

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

test.component.html

 <md-list-item routerLink="2" routerLinkActive="active">
  <md-icon md-list-icon>face</md-icon>  <!--Icon not displaying here!-->

    <div fxFlex="10"></div>
    <div *ngIf="sidenavWidth > 6" class="sidenav-item">
      <a *ngFor="let cat of categories; let i = index" href="javascript:; " class="list-group-item " (click)="getProducts(cat._id,i)">{{cat.category_name}}</a>
    </div>

  </md-list-item>

我的 \ src \ index.html

<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title>Food4Smiles</title>
  <base href="/">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/web-animations/2.2.2/web-animations.min.js"></script>
  <link href="https://fonts.googleapis.com/icon?family=Material+Icon‌​s" rel="stylesheet">
  <link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.css">
  <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="icon" type="image/x-icon" href="assets/static/hmicon.png">
</head>

<body>
  <app-root></app-root>
  <script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>

</html>

1 个答案:

答案 0 :(得分:0)

更新的答案:

<强>的index.html

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

<强> test.component.html

 <md-list-item routerLink="2" routerLinkActive="active">
  <md-icon md-list-icon>face</md-icon>  <!--Icon not displaying here!-->

    <div fxFlex="10"></div>
    <div *ngIf="sidenavWidth > 6" class="sidenav-item">
      <a *ngFor="let cat of categories; let i = index" href="javascript:; " class="list-group-item " (click)="getProducts(cat._id,i)">{{cat.category_name}}
     </a>
   </div>

 </md-list-item>

<强> \ SRC \ index.html的

<!doctype html>
<html>

<head>
  <meta charset="utf-8">
   <title>Food4Smiles</title>
  <base href="/">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/web-animations/2.2.2/web-animations.min.js"></script>
  <link href="https://fonts.googleapis.com/icon?family=Material+Icon‌​s" rel="stylesheet">
  <link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.css">
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <link rel="icon" type="image/x-icon" href="assets/static/hmicon.png">
</head>

<body>
  <app-root></app-root>
  <script src="https://code.jquery.com/jquery-3.2.1.js" integrity="sha256-DZAnKJ/6XZ9si04Hgrsxu/8s717jcIzLy3oi35EouyE=" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</body>

</html>