#js #trycatch
An amazing new JavaScript operator has arrived and things are not looking too good for try-catch!
While we wait for ?= to become natively integrated into JavaScript, we can start it now with this polyfill
β Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
#angular #signals #service #matchMedia
To achieve the desired outcome, Iβve opted for an approach that follows this pattern:
β Create a service with a `mediaQuery()` method, which returns an RxJS Observable containing information on whether a specific breakpoint is matched or not.
β Create a property inside the component class (in the example we will call it `isMobile`, since we have only one breakpoint) and bind it the the `mediaQuery()` method previously crafted, but also converting the Observable to a signal.
β Utilize the `NgClass` directive to dynamically apply a class based on the value of the `isMobile` property.
β Article Link
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π1
π1