Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reload a page using Angularjs?

I have a link. When user will click in this link, then the page will be reloaded. I did it by the following way......

Html

<div data-ng-hide="backHide" class="offset6 pull-right">
     <a href="" data-ng-click="backLinkClick()"><< Back  <br/> <br/></a>
 </div>

JS

$scope.backLinkClick = function () {
            window.location.reload(false); 
        };

In the controller I have used javascript and that seems to me very bad. How can I do it using angularjs

like image 743
Atish Dipongkor Avatar asked Sep 13 '13 07:09

Atish Dipongkor


2 Answers

Be sure to include the $route service into your scope and do this:

$route.reload();

See this:

How to reload or re-render the entire page using AngularJS

like image 85
Scalpweb Avatar answered Oct 26 '22 18:10

Scalpweb


You can also try this, after injecting $window service.

$window.location.reload();
like image 20
justnajm Avatar answered Oct 26 '22 16:10

justnajm