projects/common/layout/observers/media-query.directive.ts
import { CngxMediaQuery } from '@cngx/common/layout'
Reactive media query directive that exposes a matches signal.
matches
Wraps window.matchMedia() with automatic cleanup. Usable for responsive layouts, drawer mode switching, conditional rendering, or any behavior that depends on viewport/preference queries.
window.matchMedia()
<div cngxMediaQuery="(min-width: 1024px)" #mq="cngxMediaQuery"> <nav [cngxDrawerPanel]="drawer" [mode]="mq.matches() ? 'side' : 'over'"> … </nav> </div>
<div cngxMediaQuery="(prefers-color-scheme: dark)" #dark="cngxMediaQuery"> @if (dark.matches()) { <span>Dark mode active</span> } </div>
https://cngxjs.github.io/cngx/examples/#/common/layout/media-query/viewport-breakpoints
[cngxMediaQuery]
cngxMediaQuery
string
The CSS media query string to evaluate.
{ alias: 'cngxMediaQuery' }
unknown
Whether the media query currently matches.
this.matchesState.asReadonly()
no-iframes