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

Import as a standalone component #502

Open
wmehanna opened this issue Jun 18, 2024 · 1 comment
Open

Import as a standalone component #502

wmehanna opened this issue Jun 18, 2024 · 1 comment

Comments

@wmehanna
Copy link

i was wondering how to use this library in a project that only uses standalone components.

I tried adding in the providers array the following:
export const appConfig: ApplicationConfig = { providers: [ importProvidersFrom( UiSwitchModule.forRoot({ size: 'small', color: '#e91345', switchColor: '#FFF', switchOffColor: '#FFF', defaultBgColor: '#e91345' }), ),... ]

and then adding UiSwitchModule in the @component as follow:
@Component({ standalone: true, imports: [ CommonModule, UiSwitchModule ],....

i'm getting the following error:

_Error: apps/mobile/src/app/login-page/login.page.ts:12:3 - error NG2012: Component imports must be standalone components, directives, pipes, or must be NgModules.

12   UiSwitchModule
     ~~~~~~~~~~~~~~_
@cmckni3
Copy link
Collaborator

cmckni3 commented Nov 1, 2024

i was wondering how to use this library in a project that only uses standalone components.

I tried adding in the providers array the following: export const appConfig: ApplicationConfig = { providers: [ importProvidersFrom( UiSwitchModule.forRoot({ size: 'small', color: '#e91345', switchColor: '#FFF', switchOffColor: '#FFF', defaultBgColor: '#e91345' }), ),... ]

and then adding UiSwitchModule in the @component as follow: @Component({ standalone: true, imports: [ CommonModule, UiSwitchModule ],....

i'm getting the following error:

_Error: apps/mobile/src/app/login-page/login.page.ts:12:3 - error NG2012: Component imports must be standalone components, directives, pipes, or must be NgModules.

12   UiSwitchModule
     ~~~~~~~~~~~~~~_

@wmehanna What version of Angular?

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

No branches or pull requests

2 participants