Imports broken or not working
tmccurdy opened this issue · 3 comments
tmccurdy commented
I used to be able to write the imports like this:
imports: [
CommonModule,
HttpClientModule,
HttpClientInMemoryWebApiModule.forRoot(MockDataApi, { dataEncapsulation: false })
],
Now, since version "0.7.0", it has to be written like this, which when done, you can no longer use the "passThru" option because now the standard WebApi won't exist while "mocking=true":
imports: [
CommonModule,
env.useMockData ? HttpClientInMemoryWebApiModule.forRoot(MockDataApi, { dataEncapsulation: false }) : HttpClientModule,
],
If I try to do the first way above, I get this error every time:
Cannot instantiate cyclic dependency! HttpClient ("[ERROR ->]"): in NgModule AppModule in ./AppModule@-1:-1
tmccurdy commented
Here's a sample demonstrating this does not work.
sample.zip
vishal423 commented
I use below syntax in my application and it works without any issues:
HttpClientModule,
BUILD_PROFILE === 'standalone'
? HttpClientInMemoryWebApiModule.forRoot(InMemoryDataService, {
delay: 500,
passThruUnknownUrl: true
})
: []
],
tmccurdy commented
It doesn't work. Is anyone able to take the sample project I attached and see what I am doing wrong?