I'm trying to run the .parallax () function of the Materialize framework using angular paths. I configured the document.ready layer for each template because I found that with each template call per route the script was reloaded, however I was wrong. What would be the best way to run document.ready by running the functions I need every time the template is loaded?
Route HTML template:
<!-- JS -->
<script type="text/javascript">
var teste = function(){
$('.parallax').parallax(); //roda somente a primeira vez
};
</script>
<!-- Template -->
<div class="" ng-controller="homeCtrl">
...
</div>
Controller:
app.controller('homeCtrl', ['$scope', function($scope){
//Ready
angular.element(document).ready(function() {
$('.parallax').parallax(); // Ocorre erro
});
}]);
I look forward to alternatives.