Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Imports broken or not working #236

Open
tmccurdy opened this issue Mar 7, 2019 · 3 comments
Open

Imports broken or not working #236

tmccurdy opened this issue Mar 7, 2019 · 3 comments

Comments

@tmccurdy
Copy link

tmccurdy commented Mar 7, 2019

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
Copy link
Author

Here's a sample demonstrating this does not work.
sample.zip

@vishal423
Copy link
Contributor

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
Copy link
Author

It doesn't work. Is anyone able to take the sample project I attached and see what I am doing wrong?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants