Getting ERROR in UiSwitchModule is not an NgModule
mobiyan opened this issue · comments
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,
],
Just a note, this is actually working, I am just wondering about the error.
same here and it brakes lazily loaded modules.
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
I am getting this same error anyone manage to resolve it?
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';
it's not working for me. Any other way?
can't work for me either, who can help to update it ? ????
I found using @daominhsangvn solution worked like a charm, prob should get merged in
+1
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';
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 ^_^
Was there ever a resolution to this?
@brianeletype , Try this library. https://github.com/webcat12345/ngx-ui-switch
I did and I oddly got the same error.
Could you please create issue on my repository so I can check and update package?
That fixed it
Still not fixed. Don't waste your time with it
Not working for Angular (Angular 4)
@TeodorKolev , Did you tried ngx-ui-switch?
@webcat12345 yes, and btw I do not see any difference. Problem is in component.
@webcat12345 you can do pull request or fork, instead of steal people code and post it like your own
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.
@webcat12345 all you did is to add "/src". Good job. And it is not working with Anuglar 4
What error you got? Just tried with new Angular-cli project and it works.
Create issue on repository.
'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.
Did you imported module correctly?
- import { UiSwitchModule } from 'ngx-ui-switch/src'
- imports: [
UiSwtichModule
],
You should add these code to the module where you want to use.
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!
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';
import { UiSwitchModule } from '../../../node_modules/angular2-ui-switch/src/index';
For me i am using Angular 4, sometimes it works perfectly but other times without any change it stops!
@webcat12345 - This https://github.com/webcat12345/ngx-ui-switch worked for me. Thank you!
Doesn't work for angular 4 :(
- Point properly ngx-ui-swith module in app.module
such as
import { UiSwitchModule } from '../../node_modules/ngx-ui-switch'; - In angular.json include below script
"styles": [
"node_modules/ngx-ui-switch/ui-switch.component.css"
],