Using Jquery With Anugularjs Not Working

34 views
Skip to first unread message

harila...@gmail.com

unread,
Apr 30, 2016, 12:10:14 PM4/30/16
to AngularJS
I have a simple jquery file named animations.js and this is all it contains

    $(function(){


    $
("#recurringMonthlyExpensesDiv").on('click', function(){
    $
("#recurringMonthExpensesUL").slideToggle();
   
});


   
});


I want to use jquerys slideToggle function as you can see I am even running the function within a document ready function but this does not work. I have checked the order in which my files are loaded and they seem to be fine. The order is my app.js, controllers.js, jquery.js and animations.js I have even tried moving my custom animations.js file down just before the closing body tag in the index.html file still not working - any ideas?

Vaibhav Gupta

unread,
May 2, 2016, 3:17:19 AM5/2/16
to AngularJS
Hi,

Angular has inbuilt version of jquery called jqLite. jqLite is a subset of jQuery, hence it does not contain all jQuery functions. Angular will use jQuery if it is available, i.e. jQuery is included before angular.js. Your code might not be working due to incorrect ordering of jquery and angular.js. You may want to include jQuery before angular.js and give it a try.

I hope this helps.

Regards,

Vaibhav Gupta
Reply all
Reply to author
Forward
0 new messages