jQuery + Angularjs + Materialize CSS error

Asked

Viewed 243 times

3

I have the following procedure in my angular controller:

$(document).ready(function(){
  angular.element('.button-collapse').sideNav();
  angular.element('.parallax').parallax();
});

I’m starting these components of materialize css. When I first enter this page everything is Ok, but in case I click on a link inside the site that redirects me to the page, the following error occurs:

jQuery.Deferred exception: Cannot read property 'indexOf' of undefined TypeError: Cannot read property 'indexOf' of undefined
    at r.fn.load (localhost:8080/assets/libs/jquery-3.1.0.min.js:4:18716)
    at HTMLImageElement.<anonymous> (localhost:8080/assets/libs/materialize.min.js:8:4380)
    at Function.each (localhost:8080/assets/libs/jquery-3.1.0.min.js:2:2815)
    at r.each (localhost:8080/assets/libs/jquery-3.1.0.min.js:2:1003)
    at HTMLDivElement.<anonymous> (localhost:8080/assets/libs/materialize.min.js:8:4341)
    at Function.each (localhost:8080/assets/libs/jquery-3.1.0.min.js:2:2815)
    at r.each (localhost:8080/assets/libs/jquery-3.1.0.min.js:2:1003)
    at r.a.fn.parallax (localhost:8080/assets/libs/materialize.min.js:8:3872)
    at HTMLDocument.<anonymous> (localhost:8080/assets/js/app.js:25:36)
    at j (localhost:8080/assets/libs/jquery-3.1.0.min.js:2:29568) undefined

I couldn’t solve it.. I’m starting on this platform.. Someone can help me.?

  • From what I understand, the element you’re trying to select doesn’t exist in the context you’re in. If you can, put a little more code on it so I can understand better.

1 answer

0


  • I think you’re wrong when you say that angular.element does not select elements through the class name. It does yes, even I’ve seen in a system in my work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.