I am trying to use ng2-datetime. However, when I follow the instruction and installed npm install --save ng2-datetime, I get the following error.
I have tri
Wasted a good amount of time, here is what I did and didn't help.
npm uninstall -g angular-cli
npm uninstall -g @angular/cli
npm cache clear --force
npm cache clean
npm install -g @angular/cli
and all other usual things,
In my case I had to do the following:
npm install --save @types/jquery
Import jquery in the .angular-cli.json
"scripts": [
"../node_modules/jquery/dist/jquery.js"
],
change code from
import $ from 'jquery';
to
import * as jquery from 'jquery';
note: issue started after angular upgrade from 4.2 to 5.2
You need to import jquery with angular-cli.
Edit your angular-cli.json file.
Find script array and add jquery.
"scripts": [
"../node_modules/jquery/dist/jquery.min.js"
],
import * as $ from 'jquery';
window['$'] = window['jQuery'] = $;
The sencond line will fix your issue!