Schematics to help you migrate constructor based injections in Angular code bases to inject
- Today's constructor based injections only work because Angular uses a flag that enables TypeScripts old behavior of how constructor properties are evaluated. Therefore using
inject
makes your code more future proof. - When using constructor based injections in combination with injection tokens, you do not get proper type safety. With
inject
this is not a problem. inject
makes it super convenient to inject services in combination with inheritance. No need forsuper
calls.
Find out more about advantages of using the inject function.
npx inject-pilot