DEV Community

Cover image for Ng-News: Episode 22/20
Rainer Hahnekamp
Rainer Hahnekamp

Posted on

3 1

Ng-News: Episode 22/20

This is a weekly posting, covering the latest updates from the Angular community.

inject function in Angular 14

For more than half a year, we have been waiting for Standalone Components and typed forms. Now, as it is just a matter of a few weeks, we suddenly get a third feature with the potential for significant changes.

Younes Jaaidi published an article about an inject function which was added in the rc-1 for Angular 14. With that function, you can synchronously request elements from the dependency injection. Use cases are that you can use it instead of the @Inject decorator to gain more type safety or use it instead of the constructor. That could reduce the boilerplate code.

There are some constraints as well. For example, it can only be used in the construction context, including the constructor itself and field and function declarations. And it is only available inside Components, Services, Pipes, and Directives. So Angular will not abandon classes and use functions.

Younes summarized potential use cases along anti-patterns in his article. But, as always, when something new arrives, it is a bitlittle unclear if and how it will affect the way we will write Angular applications in the future.

Article series Angular 14 - Netanel Basal

Netanel Basal also wrote an article about the inject function. Actually, he wrote a complete series of all upcoming features in Angular 14. So definitely, worth reading it.

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

πŸ‘₯ Ideal for solo developers, teams, and cross-company projects

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay