I am on React 16.8.6 and TypeScript 3.4.3, and I followed the instructions as much as possible. My project is just a small proof-of-concept with a single @Injectable service, a single @Injected attribute (see below) and a simple @Module({ providers: [ContentService] }) on the main application component. One exception is that I had to allow for the injected attribute to be uninitialized:
@Inject contentService!: ContentService;
However, when componentDidMount() tries to call a method on contentService, the attribute is undefined.
I am on React 16.8.6 and TypeScript 3.4.3, and I followed the instructions as much as possible. My project is just a small proof-of-concept with a single
@Injectableservice, a single@Injected attribute (see below) and a simple@Module({ providers: [ContentService] })on the main application component. One exception is that I had to allow for the injected attribute to be uninitialized:@Inject contentService!: ContentService;However, when
componentDidMount()tries to call a method oncontentService, the attribute is undefined.