vendredi 24 juin 2016

AngularJS + jQuery: jQuery Returns only native dom objects

I have a huge problem. I want to select a DOM-Element using jQuery. This happens inside an AngularJS http-request. It works when runtime has past but when I call the function immediately after the page load, jQuery returns only a native JS DOM-Object.

The code is nothing special. It's only:

$http({ "methode" : "GET", "url" : <URL>, "cache" : true })
.success(function(data){
   ...
   var jQueryElement = jQuery("#" + params.elemId);
   jQueryElement[0].previousElementSibling.children[1].classList.add("active");
   ...
});

This request is inside a function of an angularjs controller. How I said before, when it's called directly after the page load jQuery( ... ) only returns a native DOM-object.

Does someone know how to fix this?




Aucun commentaire:

Enregistrer un commentaire