use jquery in angular
// In the console // First install jQuery npm install --save jquery // and jQuery Definition npm install -D @types/jquery =======================================(in angular) import * as $ from 'jquery'; // $('#elemId').width(); // OR // CommonJS style - working with "require" import $ = require('jquery') // $('#elemId').width();
Source: stackoverflow.com
jquery in Angular
//first step: npm install --save jquery npm install -D @types/jquery //secong step: "scripts": [ "node_modules/jquery/dist/jquery.min.js" ] //third step: <script type="text/javascript" src="assets/js/jquery-2.1.1.min.js"></script> //fourth step in .ts file: import * as $ from 'jquery'; ngOnInit(): void { this.GET_LOGIN_FORM_VALUE(); $(document).ready(() => { $("button").click(() => { $("h3").css("color", "red"); }); }); }
declare * angular jquery
declare var $:any;
add jquery angular
../node_modules/jquery/dist/jquery.min.js
Source: blog.bitsrc.io