yuyang041060120 / angular2-ui-switch

angular2 ui switch component
http://yuyang041060120.github.io/angular2-ui-switch
MIT License
57 stars 36 forks source link

Getting ERROR in UiSwitchModule is not an NgModule #7

Open mobiyan opened 7 years ago

mobiyan commented 7 years ago

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 commented 7 years ago

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

skriems commented 7 years ago

same here and it brakes lazily loaded modules.

jeremythille commented 7 years ago

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 commented 7 years ago

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

karldiggle commented 7 years ago

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 commented 7 years ago

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

helxsz commented 7 years ago

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

Opticsponge commented 7 years ago

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

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

nomanbiniqbal commented 7 years ago

+1

jimit-hothi commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

eletype commented 7 years ago

Was there ever a resolution to this?

webcat12345 commented 7 years ago

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

eletype commented 7 years ago

I did and I oddly got the same error.

webcat12345 commented 7 years ago

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

webcat12345 commented 7 years ago

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

eletype commented 7 years ago

That fixed it

TeodorKolev commented 7 years ago

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

TeodorKolev commented 7 years ago

Not working for Angular (Angular 4)

webcat12345 commented 7 years ago

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

TeodorKolev commented 7 years ago

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

TeodorKolev commented 7 years ago

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

webcat12345 commented 7 years ago

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 commented 7 years ago

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

webcat12345 commented 7 years ago

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

TeodorKolev commented 7 years ago

@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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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

ketimaBU commented 7 years ago

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

chouhanaditya commented 7 years ago

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

akashzcoder commented 6 years ago

Doesn't work for angular 4 :(

vinayadepu commented 5 years ago
  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" ],