网站搜索

typescript - 我无法在浏览器中获取单独的星形图标


我无法在浏览器中获取独立的星形图标。以下是我所做的:

  1. 我在 app.component.ts 类中放置了一个对象

    post = {
      valu:true
    }
    
  2. 我在我创建的一个组件中放置了以下代码,即 star.component.html

    <span
    class ="glyphicon" 
    [class.glyphicon-star]="valu"
    [class.glyphicon-star-empty]="!valu"
    (click)="onclick()"
    class="glyphicon glyphicon-globe"
    >
    </span>
    
  3. 以及 app.component.html 中的代码

    <app-star 
      [valu]="post.valu"
    >
    
    </app-star>
    
  4. 在 star.component.ts 中放置了输入装饰器

    @Input() valu:boolean;
    

附注:我已经安装了 Bootstrap