Utilizing Window.Innerwidth in my Angular Project has been successful, however, I encountered an issue when attempting to implement it into Angular Universal. The content within window.innerwidth does not appear in the view source. Here is a snippet of my code:
hidemobile: any;
hidedesktop: any;
onresize() {
let width = window.innerWidth;
if (width < 420) {
this.hidemobile = false;
this.hidedesktop = true;
} else {
this.hidemobile = true;
this.hidedesktop = false;
}
}
The HTML structure looks like this:
<div *ngIf="hidedesktop" class="top_projects_section">
<h2>TOP Header</h2>
</div>
<div *ngIf="hidemobile" class="top_projects_section">
<h2>TOP Header</h2>
</div>