ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

Implement AOT #70

Closed 0cv closed 7 years ago

0cv commented 7 years ago

This will resolve https://github.com/ng2-ui/ng2-datetime-picker/issues/67

Build must now be run with npm run ngc

HerokunTan commented 7 years ago

But still... image

0cv commented 7 years ago

which command did you run or how did you produce this log?

HerokunTan commented 7 years ago

image image I am a Chinese,I can read but not good at write...

allenhwkim commented 7 years ago

This module has just been updated, could you run it again with the new version 0.11.0? Now every .ts has .metadata.json, which works for AoT.

HerokunTan commented 7 years ago

ok,I give it a try..

HerokunTan commented 7 years ago

thank you

HerokunTan commented 7 years ago

still have same wrong....... image this is my .ts file image

0cv commented 7 years ago

@HerokunTan not sure where your issue comes from, but I can tell you that it works for me perfectly fine in my project. Ensure you're really using the 0.11.0 version npm install ng2-datetime-picker@0.11.0 --save as npm is not even updated at the time we speak: https://www.npmjs.com/package/ng2-datetime-picker

If that still does not work, double check your tsconfig.json which could well be have a glitch. In my case, the most relevant parts are:

     ...
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "strictNullChecks": false,
    "rootDirs": [".", "node_modules"],
    "outDir": "./dist",
    "removeComments": true,
     ...

and also:

"angularCompilerOptions": {
   "genDir": "dist",
   "skipMetadataEmit" : true,
   "debug": true
  },
allenhwkim commented 7 years ago

@Krisa, .ngfactory.d.ts have been removed. Is this necessary?

0cv commented 7 years ago

@allenhwkim normally we need only the .js files (i.e. no *.ts). When I look at the module I installed from Npm, this looks good: image

Actually, only the dist/ folder is needed (without dist/src). app/ and src/ could be gone but this does not change much here anyway. And in the dist/ folder, we can see the *.metadata.json files, so all feel good

HerokunTan commented 7 years ago

It will be work for me but have another issue image

HerokunTan commented 7 years ago

I change datetime-picker.component.d.ts file source code image and it work for me now @Krisa thanks!

0cv commented 7 years ago

@HerokunTan you shall not need to edit these source files. Are you sure you're really using the latest version? Seeing the screenshot above (2 posts ago), node_modules/ng2-datetime-picker/dist/datetime-picker.component.ngfactory.ts is not existing in my case... Please check the version field in node_modules/ng2-datetime-picker/package.json, that shall be 0.11.0.

wouterter commented 7 years ago

Hi, fresh install of 0.11.2 here. Same problem:

ERROR in [default] [...]\src\compiled\node_modules\ng2-datetime-picker\dist\datetime-picker.component.ngfactory.ts:327:21 Property '_hours' is private and only accessible within class 'DateTimePickerComponent'.

ERROR in [default] [...]\src\compiled\node_modules\ng2-datetime-picker\dist\datetime-picker.component.ngfactory.ts:333:21 Property '_minutes' is private and only accessible within class 'DateTimePickerComponent'.

Perhaps this is caused by combining @ViewChild with private?

allenhwkim commented 7 years ago

0.11.3 changed _hours, _minutes to public.

wouterter commented 7 years ago

Thank you! Now AOT compilation works for me.