我有一个带有断点观察器的服务。但是我们如何触发断点观察器覆盖所有分支和行的窗口调整大小事件。
export class BreakPointService {
isSmallDevice ;
constructor(private breakpointObserver: BreakpointObserver) {
this.breakpointObserver.observe([`(max-width: 899px)`,
`(min-width: 900px)`])
.subscribe(result => {
if (result.matches) {
if (result.breakpoints[`(max-width: 899px)`]) {
this.isSmallDevice = true;
}
if (result.breakpoints[`(min-width: 900px)`]) {
this.isSmallDevice = false;
}
}
});
}
}