-1

I am trying to integrate jquery in webpack in angularjs. I tried many ways it not working for me. Actually i am trying to import jquery from node_modules, but it is not importing. please suggest me some way. Because of unloading jQuery, every where giving error,

jQuery is not defined.

Thanks in advance.

Hardik Vaghani
  • 2,163
  • 24
  • 46
Ramya
  • 49
  • 1
  • 7

1 Answers1

0

Seems like you want to run jquery code inside Angular. This is not supported and you should find a way to do things the Angular way instead of the jQuery way. This is somewhat of a mindset change you will find that once you do everything the Angular way you would never have to ever write a jQuery selector $("#foo") again.

johan
  • 998
  • 6
  • 20
  • I am trying to integrate angular-slick,it depends on jquery slick js file,this file depends on jquery file.so i need to import jquery.i tried to import as external file and also from node_modules,it is not loading – Ramya Jul 15 '16 at 11:23
  • could you post your index file, you don't need to import anything you simply need to link to jquery.js before angular.js – johan Jul 15 '16 at 11:25
  • if i use cdn it is working.atleast considering file.if i import ,it is showing error ,'jQuery' is not defined in transition.js(bootstrap).if i solve this,again in slick file,'jQuery' is not defined – Ramya Jul 15 '16 at 11:26
  • import jQuery from 'jquery'; import angular from 'angular'; import uirouter from 'angular-ui-router'; import angular_animate from 'angular-animate' import angularSanatize from 'angular-sanitize'; import formly from 'angular-formly'; import formlyBootstrap from 'angular-formly-templates-bootstrap'; import uibootstrap from 'angular-bootstrap-npm'; import ngMessages from 'angular-messages'; import ngCookies from 'angular-cookies'; import 'angular-file-upload'; //module declaration – Ramya Jul 15 '16 at 11:28
  • not sure why you are using import statements, I suggest you start with an angular-seed template, use – johan Jul 15 '16 at 11:33
  • ya i used this,again,slick is not function.for this they are saying jquery file should load first.what i should do for this – Ramya Jul 15 '16 at 11:40
  • from three days i am trying to solve this.i am not finding why it is like this. – Ramya Jul 15 '16 at 11:42
  • Uncaught ReferenceError: jQuery is not defined(anonymous function) @ transition.js:59(anonymous function) @ app.bundle.js:1643__webpack_require__ @ app.bundle.js:20(anonymous function) @ npm.js:2(anonymous function) @ app.bundle.js:1637__webpack_require__ @ app.bundle.js:20(anonymous function) @ app.js:93(anonymous function) @ app.bundle.js:491__webpack_require__ @ app.bundle.js:20(anonymous function) @ multi_app:2(anonymous function) @ app.bundle.js:47__webpack_require__ @ app.bundle.js:20(anonymous function) @ app.bundle.js:40(anonymous function) @ app.bundle.js:43 – Ramya Jul 15 '16 at 11:42
  • I have found over long time that if the component doesn't play nice, try a different component. There are lot's of carousels that you can use https://github.com/revolunet/angular-carousel – johan Jul 15 '16 at 11:45
  • If we want to import any library,they should export that module.In jQuery they did not export module,so we can not import. – Ramya Aug 02 '16 at 05:16