无法隐藏角度分量

I need to hide the hamburger, styles hide the content, but not the component. Is it normal practice to add a class to a component and write styles on it? thanks for the help enter image description here

评论
  • 为何
    为何 回复
     Yes, it is a best practice to write className and write its styles in hamburger.css or what ever the style component will be. 
        You can simply takeout the selector from index.html. 
        It will be good if i can see your index.html and hamburger component. 
    

    否则,您可以简单地保留* ngIf来显示和隐藏该组件

  • Stanf
    Stanf 回复

    我建议您使用类似的指令

    *ngIf

    正确时,请显示汉堡包。 您必须添加html代码

    <button *ngIf="showHamburger" ></button>
    

    在包含汉堡包的组件中,带有条件的变量showHamburger。真实,显示汉堡包,真实,显示汉堡包