jQuery Error + AngularJS + Materialize CSS

3

I have the following procedure on my angle controller:

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

I'm starting these materialize css components. When I first enter this page everything is Ok, but if 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 could not solve it ... I'm starting on this platform .. can anyone help me?

    
asked by anonymous 14.07.2016 / 22:32

1 answer

0

angular.element can not make css-selectors newm by tagname nor .classname to make this selection you have two hypotheses:

  • a) Include the jQuery first as the Angular, so the angular.element gets an alias for $
  • b) uses, as it says in the docs, document.querySelectorAll()
07.10.2016 / 12:57