Angular Links

0

I'm having some headaches, because I need to create a function that allows validating when the link should redirect to the location or when it should not, for example, I'm loading an image and clicking the link should not load, I created a function

asked by anonymous 05.02.2016 / 17:52

1 answer

1

I do not quite understand your question, but if you want to do something only when the page is fully loaded you can use $ viewContentLoaded .

Example:

Controller:

  var redirecionar = false;
  $scope.$on('$viewContentLoaded', function() {
      redirecionar = true;
      console.log("Rota carregada")
  });

 $scope.acessar = function() {
     if (redirecionar) {
         console.log("Página Carregada! Redirecionando..")
         //implementar redirecionamento
     } else {
         console.log("Pagina não carregada!")
     }
 }

View:

<a href="" ng-click="acessar()">Clique Aqui!</a>
    
05.02.2016 / 18:50