concept ObservableMedia in category angular

appears as: ObservableMedia
Angular Development with Typescript, Second Edition

This is an excerpt from Manning's book Angular Development with Typescript, Second Edition.

In chapter 7, you’ll rewrite ngAuction, and you’ll see how the ObservableMedia class from the Flex Layout library will notify you about changes in the screen size (for example, the user reduces the width of the window). This observable is also quite handy in changing the UI layout based on the viewport width of smaller devices like smartphones and tablets.

We’ll show you how to use the Flex Layout library for implementing RWD and how to use its ObservableMedia service to spare you from writing lots of CSS.

The Angular Flex Layout library (see https://github.com/angular/flex-layout) is a UI layout engine for implementing RWD without writing media queries in your CSS files. The library provides a set of simple Angular directives that internally apply the rules of the flexbox layout and offer you the ObservableMedia service that notifies your app about the current width of the viewport on the user’s device.