以下代码基于匹配的屏幕宽度(通过“ ng serve”运行)可以正常工作,但是在“ ng build”之后无法正常工作-从dist服务
export class PicturesDialogComponent {
constructor(private breakpointObserver: BreakpointObserver, public dialogRef: MatDialogRef<PicturesDialogComponent>) {
this.breakpointObserver.observe([Breakpoints.Medium]).subscribe((screenSize: BreakpointState) => {
if (screenSize.matches) {
// my custom logic for specific matching screen-width
}
});
}
}
我看到该代码在dist文件夹中可用,但是只是[ng build之后]不会将其解雇。它不是关于Breakpoints.Medium的,但是我添加了所有可用的选项,例如Breakpoints.Web等,它仍然无法正常工作!