📜  media$' 已弃用 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:02.259000             🧑  作者: Mango

代码示例1
ngOnInit() {
    this.mediaSub = this.mediaObserver.asObservable() // New Way asObservable()
    .pipe(
      filter((changes: MediaChange[]) => changes.length > 0),
      map((changes: MediaChange[]) => changes[0])
    ).subscribe((change: MediaChange) => {
      console.log(change.mqAlias)
    }
    )
  }