Open GrandSchtroumpf opened 5 years ago
When the providers key of NgModule ends with a provider object (like {provide: '', useValue: ''}) the method addProviderToModule has an unexpected result :
providers
NgModule
{provide: '', useValue: ''}
addProviderToModule
@NgModule({ providers: [ { provide: '', useValue: '', providers: [{ provide: TOKEN, useValue: 'someValue' }] } ] })
I've run some tests :
providers: [SomeProvider]
providers: [{ provide: '', useValue: '' } as Provider]
providers: [{ provide: '', useValue: '' }, SomeProvider]
providers: [{ provide: '', useValue: '' }]
providers: [SomeProvider, { provide: '', useValue: '' }]
When the
providers
key ofNgModule
ends with a provider object (like{provide: '', useValue: ''}
) the methodaddProviderToModule
has an unexpected result :I've run some tests :
providers: [SomeProvider]
providers: [{ provide: '', useValue: '' } as Provider]
providers: [{ provide: '', useValue: '' }, SomeProvider]
providers: [{ provide: '', useValue: '' }]
providers: [SomeProvider, { provide: '', useValue: '' }]