angular2-ui-switch icon indicating copy to clipboard operation
angular2-ui-switch copied to clipboard

Getting ERROR in UiSwitchModule is not an NgModule

Open mobiyan opened this issue 7 years ago • 35 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, ],

mobiyan avatar Jan 25 '17 03:01 mobiyan

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

mobiyan avatar Jan 25 '17 03:01 mobiyan

same here and it brakes lazily loaded modules.

skriems avatar Jan 25 '17 17:01 skriems

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

jeremythille avatar Jan 26 '17 07:01 jeremythille

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

karldiggle avatar Jan 29 '17 20:01 karldiggle

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';

karldiggle avatar Jan 30 '17 09:01 karldiggle

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

webcat12345 avatar Mar 03 '17 01:03 webcat12345

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

helxsz avatar Mar 13 '17 08:03 helxsz

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

https://github.com/yuyang041060120/angular2-ui-switch/issues/2

Opticsponge avatar Mar 17 '17 01:03 Opticsponge

+1

nomanbiniqbal avatar Apr 06 '17 16:04 nomanbiniqbal

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';

jimit-hothi avatar Apr 21 '17 13:04 jimit-hothi

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 ^_^

kovorka avatar Apr 23 '17 14:04 kovorka

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

webcat12345 avatar Apr 23 '17 15:04 webcat12345

Was there ever a resolution to this?

eletype avatar May 22 '17 23:05 eletype

@brianeletype , Try this library. https://github.com/webcat12345/ngx-ui-switch

webcat12345 avatar May 22 '17 23:05 webcat12345

I did and I oddly got the same error.

eletype avatar May 22 '17 23:05 eletype

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

webcat12345 avatar May 22 '17 23:05 webcat12345

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

webcat12345 avatar May 22 '17 23:05 webcat12345

That fixed it

eletype avatar May 22 '17 23:05 eletype

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

TeodorKolev avatar May 23 '17 13:05 TeodorKolev

Not working for Angular (Angular 4)

TeodorKolev avatar May 23 '17 14:05 TeodorKolev

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

webcat12345 avatar May 23 '17 14:05 webcat12345

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

TeodorKolev avatar May 23 '17 14:05 TeodorKolev

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

TeodorKolev avatar May 23 '17 14:05 TeodorKolev

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 avatar May 23 '17 14:05 webcat12345

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

TeodorKolev avatar May 23 '17 14:05 TeodorKolev

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

webcat12345 avatar May 23 '17 14:05 webcat12345

@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.

TeodorKolev avatar May 23 '17 14:05 TeodorKolev

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.

webcat12345 avatar May 23 '17 14:05 webcat12345

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!

legolas avatar Jun 01 '17 18:06 legolas

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';

adadgio avatar Jun 23 '17 15:06 adadgio

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

myopenresources avatar Jun 29 '17 01:06 myopenresources

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

ketimaBU avatar Jul 08 '17 21:07 ketimaBU

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

chouhanaditya avatar Jul 13 '17 17:07 chouhanaditya

Doesn't work for angular 4 :(

akashzcoder avatar Jan 05 '18 06:01 akashzcoder

  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" ],

vinayadepu avatar Jul 16 '19 08:07 vinayadepu