Angled responsive design 2+

3

Is it possible through angle 2+ to achieve the size and width of the browser and from that, send that data to the css so that it is responsive? Is there any other way to leave responsive without half queries?

I know there is the following decorator that can get the size and width of the browser, but is there any way to make the design responsive?

Thankful

@HostListener('window:resize', ['$event'])
    
asked by anonymous 25.06.2018 / 14:00

1 answer

1

You can use the media query in your css normally. If you want to use ngIf to remove elements from the dom dynamically take a look at my answer here #

Taking width onInit

public innerWidth: any;
ngOnInit() {
    this.innerWidth = window.innerWidth;
}

To keep updated on resize.

@HostListener('window:resize', ['$event'])
onResize(event) {
  this.innerWidth = window.innerWidth;
}

Html

<div *ngIf="innerWidth > algumNumero">
    
25.06.2018 / 14:31