I want to use a jQuery plugin named jquery.shorten in Ionic project using npm.
The command for installig it is npm install jquery.shorten --save.
I have successfylly included jQuery and I am able to use it in my project. But not able to use jquery.shorten.
Following is the code which I am using to inclide jQuery and jquery.shorten. It is in app.module.ts of angular project -
import * as $ from 'jquery';
import 'jquery.shorten';
The error which I am seeing in console is -
Uncaught Error: Cannot find module "jquery.shorten"
I also tried following. This time all console error gone. But I can't find a way of using it.
import * as shortMe from 'jquery.shorten';
It should be used as $(".dynamic-multiple-elements").shorten().
I have followed few instructions to have it included. But nothing seems to be working.
I can see the folder jquery.shorten with required js file in node_modules.
I won't be able to use this solution as my elements are dynamic and many.
import 'jquery.shorten/src/jquery.shorten';Besides that, I wouldn't recommend to use jQuery in Angular at all.jquery.shortenusing specific path similar to what you have suggested. I am currently getting error saying"jQuery" is not definedeven if I have imported it and included tyings for it. I will check different ways of importing it.jQuery" is not defined? During compilation or when the application starts?