Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ngx-skeleton-loader standalone compliant #158

Open
1 of 2 tasks
alfmos opened this issue Jan 9, 2024 · 3 comments
Open
1 of 2 tasks

Make ngx-skeleton-loader standalone compliant #158

alfmos opened this issue Jan 9, 2024 · 3 comments

Comments

@alfmos
Copy link

alfmos commented Jan 9, 2024

I'm submitting a ... (check one with "x")

  • bug report => search github for a similar issue or PR before submitting
  • feature request

Current behavior
using ngx-skeleton-loader in a standalone app requires to import the module requires using ImportFromProviders

Expected behavior
import ngx-skeleton loader in standalone way, that is with a function like provideSkeletonLoader({config: configOptions})

What is the motivation / use case for changing the behavior?
As Angular evolves, modules are being stripped off, favoring direct import of components/services

Please tell us about your environment:

we use Angular 16, ubuntu 20, npm
web server is nginx and backend is in go

@caboodal
Copy link

Could somebody show how you use this component with standalone components, the above mentions ImportFromProviders, what is that and how is it implemented?

I've tried importFromProviders in my component route but I still cannot use the skeleton component in my component?

@caboodal
Copy link

caboodal commented Feb 13, 2024

Just in case anybody arrives here trying to use the component in standalone components...

Add the importProvidersFrom function call into your app.config.ts file as shown below.

export const appConfig: ApplicationConfig = {
	providers: [
		provideRouter(routes, withComponentInputBinding()),
		provideAnimations(),
		importProvidersFrom(
			NgxSkeletonLoaderModule.forRoot({ animation: 'pulse' }),
		),
	],
};

Then simply import the NgxSkeletonLoaderModule module into your component using the imports property. You can then use the <ngx-skeleton-loader> component in your standalone component.

@willmendesneto
Copy link
Owner

Thanks for sharing this @caboodal . There's a working in progress to integrate this feature. Until it didn't get finished, here's the approach to integrate in Angular Apps

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

No branches or pull requests

3 participants