I did:
npm install jquery --save
npm install @types/jquery --save-dev
Changed the angularcli.json to update the internal webpack configuration:
"scripts": ["../node_modules/jquery/dist/jquery.js"],
Then I imported it into my component.ts
import * as $ from 'jquery';
Or
import * as jquery from 'jquery';
Both did not help!
When I run this code:
alert($("button")[0].innerText);
or any other code with the '$' variable.
Then I get this error during runtime:
error_handler.js:45EXCEPTION: Uncaught (in promise): TypeError: __WEBPACK_IMPORTED_MODULE_8_jquery__.getJSON is not a functionErrorHandler.handleError
Why must it be so complicated? How can I fix that mess?