Error with jQuery on the AngularJS application


I'm trying to function this code

But when I use it on my Angular app, I found some errors, and it seems to be jQuery

var element=$('.cds'); //the problem is right here (angular.element('.cds') is the same)
console.log(element.html());  //prints undefined,
// so, no animation

How can I fix it? Any ways to use jQuery edge?


<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script type="text/javascript" src="bundle.js"></script>

As the code is in bundle.js, created with browserify, should I call jQuery too? Like var jQuery=require('jquery');? or something. Thanks for your help

Try this line in your code, after definition of done(). It will not work.


Now click the javascript button and select 'OnDomReady'

Now it works. You cannot use jQuery until domReady event.

EDIT This is the most classic method for jQuery

$( document ).ready(function() {
   /* The DOM is now loaded and can be manipulated*/