*ngIf hide some content on mobile screen, Angular 4

后端 未结 9 2180
盖世英雄少女心
盖世英雄少女心 2020-12-13 04:47

I have:

showHide: false;

Content
9条回答
  •  感动是毒
    2020-12-13 05:16

    You can use window.screen.width. Example:

    ngOnInit() {
      if (window.screen.width === 360) { // 768px portrait
        this.mobile = true;
      }
    }
    

    Html:

    
    

提交回复
热议问题