GlypIcon没有在浏览器中显示(Angular)

时间:2018-03-23 19:45:23

标签: angular

我正在学习角度,我遇到的问题似乎无法理解。在这里看到了一个解决方案Glyphicon not showing up in browser,但它对我的代码不起作用。我将不胜感激。感谢

我的Chrome浏览器上没有显示明星的GlypIcon,而且控制台没有任何错误。

FavoriteComponent.html 包含:

    <span
      class= "glyphicon"
      [class.glyphicon-star]="isFavorite"
      [class.glyphicon-star-empty]="!isFavorite"
      (click) ="onClick()"
    ></span>

FavoriteComponent.ts

     import { Component, OnInit, Input } from '@angular/core';

     @Component({
     selector: 'favorite',
     templateUrl: './favorite.component.html',
     styleUrls: ['./favorite.component.css']
     })
     export class FavoriteComponent implements OnInit {
     @Input() isFavorite: boolean;
     constructor() { }

      ngOnInit() {
       }

     onClick (){
      this.isFavorite = !this.isFavorite;
      }
     }

app.component.ts :           从&#39; @ angular / core&#39;;

导入{Component}
       @Component({
       selector: 'app-root',
       templateUrl: './app.component.html',
       styleUrls: ['./app.component.css']
       })

       export class AppComponent {
       post = {
       title : 'Angular app',
       isFavorite: true
         }
        }

app.module.ts:

      import { BrowserModule } from '@angular/platform-browser';
      import {FormsModule} from '@angular/forms';
      import { NgModule } from '@angular/core';

      import { AppComponent } from './app.component';
      import { CoursesComponent } from './courses.component';
      import { CourseComponent } from './course/course.component';
      import { CoursesService } from './courses.service';
      import { FavoriteComponent } from './favorite/favorite.component';

      @NgModule({
      declarations: [
      AppComponent,
      CoursesComponent, 
      CourseComponent, FavoriteComponent
         ],
     imports: [
     BrowserModule,
     FormsModule
       ],
      providers: [
      CoursesService
      ],
     bootstrap: [AppComponent]
      })
     export class AppModule { }

我只想在我的浏览器上显示星形图标,它没有显示。感谢

0 个答案:

没有答案