Code Monkey home page Code Monkey logo

Comments (6)

misha130 avatar misha130 commented on June 15, 2024

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.

vldkrt avatar vldkrt commented on June 15, 2024

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.

misha130 avatar misha130 commented on June 15, 2024

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.

vldkrt avatar vldkrt commented on June 15, 2024

I tried with a new ionic2 project on a android device.

datePickerTest.zip

npm install
ionic cordova platform add android
ionic cordova run android --prod

from ion-datepicker.

misha130 avatar misha130 commented on June 15, 2024

cmd
I checked and it works fine.
Maybe npm i -g ionic@latest would help

from ion-datepicker.

vldkrt avatar vldkrt commented on June 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.