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

Getting ERROR in UiSwitchModule is not an NgModule #7

Open
mobiyan opened this issue Jan 25, 2017 · 35 comments
Open

Getting ERROR in UiSwitchModule is not an NgModule #7

mobiyan opened this issue Jan 25, 2017 · 35 comments

Comments

@mobiyan
Copy link

mobiyan commented Jan 25, 2017

At runtime, I am always getting:

ERROR in UiSwitchModule is not an NgModule

I have:
import {UiSwitchModule } from 'angular2-ui-switch'

and:

imports: [
BrowserModule,
ReactiveFormsModule,
FormsModule,
HttpModule,
routing,
Ng2BootstrapModule,
UiSwitchModule,
],

@mobiyan
Copy link
Author

mobiyan commented Jan 25, 2017

Just a note, this is actually working, I am just wondering about the error.

@skriems
Copy link

skriems commented Jan 25, 2017

same here and it brakes lazily loaded modules.

@jeremythille
Copy link

It was working yesterday, and today, for some reason, ng-cli dead refuses to compile the app, with this error :

ERROR in UiSwitchModule is not an NgModule

@karldiggle
Copy link

I am getting this same error anyone manage to resolve it?

@karldiggle
Copy link

I have found a fix for this this issue you need to point the path to the src folder like this and it works :)

import { UiSwitchModule } from '../../node_modules/angular2-ui-switch/src';

@webcat12345
Copy link

webcat12345 commented Mar 3, 2017

it's not working for me. Any other way?

@helxsz
Copy link

helxsz commented Mar 13, 2017

can't work for me either, who can help to update it ? ????

@Opticsponge
Copy link

I found using @daominhsangvn solution worked like a charm, prob should get merged in

#2

@nomanbiniqbal
Copy link

+1

@jimit-hothi
Copy link

I have found a fix for this this issue you need to point the path to the src folder like this and it works :)

import { UiSwitchModule } from '../../node_modules/angular2-ui-switch/dist/index.d';

@kovorka
Copy link

kovorka commented Apr 23, 2017

Mine used to compile, but wouldn't build with the --prod --aot flags.
Then I ran npm update with and without global flags.
Now my app won't even compile.

The suggestion to use import { UiSwitchModule } from '../../node_modules/angular2-ui-switch/dist/index.d'; doesn't help me.

Seems like it works with a specific module versions or something. Any ideas?

I really don't want to pull out the switch as it looks so nice ^_^

@webcat12345
Copy link

https://github.com/webcat12345/ngx-ui-switch

@eletype
Copy link

eletype commented May 22, 2017

Was there ever a resolution to this?

@webcat12345
Copy link

@eletype
Copy link

eletype commented May 22, 2017

I did and I oddly got the same error.

@webcat12345
Copy link

Could you please create issue on my repository so I can check and update package?

@webcat12345
Copy link

webcat12345/ngx-ui-switch#23

@eletype
Copy link

eletype commented May 22, 2017

That fixed it

@TeodorKolev
Copy link

Still not fixed. Don't waste your time with it

@TeodorKolev
Copy link

Not working for Angular (Angular 4)

@webcat12345
Copy link

@TeodorKolev , Did you tried ngx-ui-switch?

@TeodorKolev
Copy link

@webcat12345 yes, and btw I do not see any difference. Problem is in component.

@TeodorKolev
Copy link

@webcat12345 you can do pull request or fork, instead of steal people code and post it like your own

@webcat12345
Copy link

Actually, I fixed AoT error of angular2-ui-switch and integrated with Angular4.
Also This forum is idle for so long time, and I am open for all pull requests and error reports.

Then please wait for your pull request merged.

@TeodorKolev
Copy link

@webcat12345 all you did is to add "/src". Good job. And it is not working with Anuglar 4

@webcat12345
Copy link

What error you got? Just tried with new Angular-cli project and it works.
Create issue on repository.

@TeodorKolev
Copy link

@webcat12345

'ui-switch' is not a known element:
1. If 'ui-switch' is an Angular component, then verify that it is part of this module.
2. If 'ui-switch' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

@webcat12345
Copy link

Did you imported module correctly?

  1. import { UiSwitchModule } from 'ngx-ui-switch/src'
  2. imports: [
    UiSwtichModule
    ],

You should add these code to the module where you want to use.

@legolas
Copy link

legolas commented Jun 1, 2017

Today I started to test the ngx-ui-switch and ran into the same error as described above.
Adding the /src to the import solved it for me!

@adadgio
Copy link

adadgio commented Jun 23, 2017

I personnaly had the exact same error because of a missing semicolomn.

import { UiSwitchModule }           from 'angular2-ui-switch' <---- ! just added ";"
import { AppComponent }             from './app.component';

@myopenresources
Copy link

import { UiSwitchModule } from '../../../node_modules/angular2-ui-switch/src/index';

@ketimaBU
Copy link

ketimaBU commented Jul 8, 2017

For me i am using Angular 4, sometimes it works perfectly but other times without any change it stops!

@chouhanaditya
Copy link

@webcat12345 - This https://github.com/webcat12345/ngx-ui-switch worked for me. Thank you!

@akashzcoder
Copy link

Doesn't work for angular 4 :(

@vinayadepu
Copy link

vinayadepu commented Jul 16, 2019

  1. Point properly ngx-ui-swith module in app.module
    such as
    import { UiSwitchModule } from '../../node_modules/ngx-ui-switch';
  2. In angular.json include below script
    "styles": [
    "node_modules/ngx-ui-switch/ui-switch.component.css"
    ],

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