Open smlombardi opened 7 years ago
You might also consider renaming this component to something less generic, as there are many SwitchComponents out there.
Ha, yea didn't think much about the naming. This was just a personal project, didn't thought anyone would actually use it. But it's really cool someone does. About the error, I came across with it before and I think it's an issue provoked by the angular version I used to create the project the first time, which was Angular 2. Using version 4> has this compatibility issues. Which versions of angular and angular-cli are you using? and the parameter for ng build? I'm guessing I'll need to rewrite this from scratch using latest versions to avoid this issues
Seems everything works running the build like this:
ng build --env=prod
Can you confirm if this works for you too?
Firstly thanks for the component. That does work. It's with aot that it doesn't work.
So, ng build --aot --env=prod
Any updates on this? I need to build using AOT...
I am also getting the same problem when i build project with AOT.
Hi,
the component/module still does not work with aot compilation in ng build.
You might want to look into the attached version of the module to fix the issue? bootstrap-switch_patched.zip
I tried a production build with using this code and the build was successful. you can try with
import { SwitchModule } from '../bootstrap-switch/switch.module';
..
imports: [
...
SwitchModule,
...
}`
Thanks @jimjaeger , did you made any changes in the component itself? Or was it just adding the switch.module.ts file? I'm currently trying to find a way to package it and make everything work, but I'm running into lot of different errors. Any help is appreciated!
After going back and forward I think I've finally found a solution for this. I changed the way I was packaging the component using this. I reached a dead end with the previous tutorial. So please update to the latest version (0.2.1) and make sure to check the installation instructions, it changed a bit since previous version due to the new packaging. Hope this finally fix this, please let me know if anything looks off.
@ovsleep Right, I added the module but also changed the visibility of the private variables because they need to be accessible when you want to use it in the html file. Also I ordered the variables and methods and changed compares based on the lint markers.
If you want to package your module in standard way here is a description: https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/preview and also a example project in the examples section: filipesilva/angular-quickstart-lib
When you are going to rewrite your module, you may think about to additionally support an Observable
@jimjaeger thanks for the doc, I'll review it and check if my packaging now respect it. Not sure about donating the code, in fact this was just an experiment trying to learn a bit of Angular, never though someone actually would try to use it. I might try to add a few other components now if everything works.
The component works great with ng serve, but when I try to build by project angular-cli throws an error: