Giter VIP home page Giter VIP logo

Comments (9)

vikasverma93 avatar vikasverma93 commented on July 1, 2024 9

Hi, after some research I got my project working.
Please note that my project was generated using angular-cli version 1.5.0
So, basically with angular 5, they have changed which TS files would be compiled.

One of these solutions might work for you

  1. tried to include ./node_modules/ng2-datetime/ng2-datetime.ts in my tsconfig.app.json, so that it is available during the compilation process
  2. Instead of compiling ng2-datetime.ts in your project with current version of [email protected]; you should import from the compiled module, like this import {NKDatetimeModule} from 'ng2-datetime/ng2-datetime.js';

Additionally you might get addition error like jQuery is not defined, which can be fixed by including jquery type in compiledOptions of you tsconfig.app.json

So, your tsconfig.app.json would look like this


{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "module": "es2015",
    "baseUrl": "./",
    "types": [
      "jquery"
    ],
    "allowSyntheticDefaultImports": true
  },
  "include": [
    "**/*.ts",
    "../node_modules/ng2-datetime/ng2-datetime.ts"
  ],
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

Let me know if you still face any issues. Thanks.

from ng2-datetime.

OskarKlintrot avatar OskarKlintrot commented on July 1, 2024 5

I needed to add the last two files below to tsconfig:

{
  "include": [
    "**/*.ts",
    "../../node_modules/ng2-datetime/ng2-datetime.ts",
    "../../node_modules/ng2-datetime/src/ng2-datetime/ng2-datetime.ts",
    "../../node_modules/ng2-datetime/src/ng2-datetime/ng2-datetime.module.ts"
  ]
}

from ng2-datetime.

tobiashoeft avatar tobiashoeft commented on July 1, 2024

Same problem here

from ng2-datetime.

Darth-Vader-2020 avatar Darth-Vader-2020 commented on July 1, 2024

Thank you vikasverma92. With your help, I was able to get this to work.

from ng2-datetime.

nkalinov avatar nkalinov commented on July 1, 2024

@tauqeer81 Were you able to make it work?
I will try to setup the demo project with angular cli for the next version

from ng2-datetime.

enigmatik avatar enigmatik commented on July 1, 2024

don't work

from ng2-datetime.

bculley avatar bculley commented on July 1, 2024

None of these options, nor anything else I've tried as made this ng5 compatible for me during karma tests

from ng2-datetime.

OskarKlintrot avatar OskarKlintrot commented on July 1, 2024

This issue occurs for me when using TS v2.6.x but not with TS v2.5.x.

from ng2-datetime.

simg avatar simg commented on July 1, 2024

None of the above solutions worked for me. What did work was switching to this fork of ng2-datetime.

https://www.npmjs.com/package/ngx-datetime (sorry nkalinov)

from ng2-datetime.

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.