-1
I’m trying to run the . Parallax() function of the Materialize framework using routes in Angularjs. I set up Document.ready for each template because I thought that every call of the template per route the script was reloaded, but I was wrong. What would be the best way to run Document.ready running the functions I need every time the template loads?
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 await alternatives.
Just by setting there, the part of the code "var test = Function(){" is wrong. It was to be "$(Document). ready(Function(){". I copied the code while I was running tests and forgot to fix it.
– Vinícius Biavatti