Parallax component - Materializecss and Angularjs

0

I'm using one page, angularjs and materializecss. I'm doing the SPA schematic of the angle, in my index.html I have a menu and a footer being among them has the tag <div ng-view></div>

I use $ routeProvider to route to the page. There's the problem. In my route '/' I have a Parallax (component of materialize css), this component should be started as materialize documentation, but start in a script on the page and does not work, like this:

init.js

(function($){
  $(function(){
    console.log('passa');
    $('.button-collapse').sideNav();
    $('.parallax').parallax();

  }); // end of document ready
})(jQuery); // end of jQuery name space

I make the call normally in the index.

index.html
<script src="/assets/js/init.js"></script>

This way it works if parallax is in my main html, but as it is in another html and is being called by angular is not being started and does not work.

I have tried to put in the page controller and the following error occurs:

TypeError: Can not read property 'indexOf' of undefined     at r.fn.load

Has anyone ever had something like this? I'm a beginner in web programming ... Thank you in advance!

    
asked by anonymous 13.07.2016 / 00:04

1 answer

0

Problem solved by initializing this way

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

In the controller of the page that has these components.

    
13.07.2016 / 14:42