Comments (6)
I tried just now and couldn't reproduce it in the demo project with --prod.
What version of ionic, ionic scripts & datepicker?
Also the error might indicate that you have an import that isnt found.
Maybe write the whole error?
from ion-datepicker.
the library versions are:
"@angular/core": "4.1.3",
"datepicker-ionic2": "2.5.1",
"ionic-angular": "3.6.0",
"@ionic/app-scripts": "2.1.4",
"ionic": "3.8.1",
"typescript": "2.3.4"
I think the libraries are up to date.
The error doesn't show much
ERROR Error: Uncaught (in promise): Error: No component factory found for undefined. Did you add it to @NgModule.entryComponents?
Error: No component factory found for undefined. Did you add it to @NgModule.entryComponents?
at K (main.js:1)
at e.resolveComponentFactory (main.js:1)
at e.resolveComponentFactory (main.js:1)
at e.resolveComponent (main.js:1)
at t._viewInit (main.js:1)
at main.js:1
at t.invoke (polyfills.js:3)
at Object.onInvoke (main.js:1)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at K (main.js:1)
at e.resolveComponentFactory (main.js:1)
at e.resolveComponentFactory (main.js:1)
at e.resolveComponent (main.js:1)
at t._viewInit (main.js:1)
at main.js:1
at t.invoke (polyfills.js:3)
at Object.onInvoke (main.js:1)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at t._fireError (main.js:1)
at t._failed (main.js:1)
at main.js:1
at t.invoke (polyfills.js:3)
at Object.onInvoke (main.js:1)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
And the way I used it is:
import {DatePickerDirective} from 'datepicker-ionic2';
providers: [DatePickerDirective]
this.datePickerDirective.open();
this.datePickerDirective.changed.subscribe(date => {
this.dateChanged(moment(date).valueOf())
});
But even if I try the directive over a button, the same error appears.
For the development use, it work's fine. Maybe the production minification could scramble something?
from ion-datepicker.
I still didnt manage to replicate it, but one thing I can say for sure you shouldn't put DatePickerDirective into providers since its directive and not an injectable.
This is how I tried to recreate your code:
@ViewChild(DatePickerDirective) public datepicker: DatePickerDirective;
public ngOnInit() {
this.datepicker.open();
this.datepicker.changed.subscribe(() => console.log('change happened'));
}
The only include you should have is the import in ngModule too.
No providers, nor entryComponents.
from ion-datepicker.
I tried with a new ionic2 project on a android device.
npm install
ionic cordova platform add android
ionic cordova run android --prod
from ion-datepicker.
I checked and it works fine.
Maybe npm i -g ionic@latest would help
from ion-datepicker.
I think actual there is an issue with the angular-cli uglify mechanism. If I use --aot it works great.
Thank you for your help. Awesome component BTW.
from ion-datepicker.
Related Issues (20)
- disableddays not working
- Clicking next month but jumping for two months
- Background color HOT 1
- how to set datepicker regional thailand buddhist year
- Error: Type Page is part of the declarations of 2 modules HOT 1
- Incorrect marked dates (dates are one day out) HOT 2
- Any way to format Date()? HOT 4
- Template parse errors: HOT 3
- Question HOT 1
- Use in angular form HOT 1
- Issue : Model not opening and min & max dates HOT 2
- datepicker Undefined
- How and where to set options? HOT 3
- disabledDays not working
- ionic 4 version HOT 1
- DisabledDates not working HOT 1
- How to pass selected date to api HOT 1
- NLS: User requests for languages
- Are you planning to support v4 HOT 5
- temp date is sometimes an invalid date when changing month HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ion-datepicker.