I have seen what seem like older Angular examples in which dependency injection is done using the "@Inject" annotation ...
import { Component, Inject } from '@angular/core';
import { ChatWidget } from '../components/chat-widget';
@Component({
selector: 'app-root',
template: `Encryption: {{ encryption }}`
})
export class AppComponent {
encryption = this.chatWidget.chatSocket.encryption;
constructor(@Inject(ChatWidget) private chatWidget) { }
}
In later versions of Angular (>= 7), is @Inject still needed if the thing being injected is annotated with @Injectable, e.g.
@Injectable({
providedIn: 'root',
})
export class ChatWidget {
I guess what I'm asking is with later versions of Angular, is there any reason to still be using @Inject?