Загрузка...

How do test code using inject()

Angular's inject function has been available since version 14 and was - next to Standalone Components - the star feature.

In this video, I explain why you want to switch from constructor-based dependency injection to inject(), although it doesn't make testing easier.

A bit about the difference between inject and TestBed.inject and finally, the TestBed.runInInjectionContext, which you require for testing an area in Angular where only inject() will work: HTTP Interceptors and Router Guards.
0:00 Introduction
0:05 Why inject()?
6:19 TestBed.inject()
10:30 TestBed.runInInjectionContext()
15:17 Summary & Farewell

Видео How do test code using inject() канала Rainer Hahnekamp
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять