How to reload or re-render the entire page using AngularJS
For the record, to force angular to re-render the current page, you can use:
$route.reload();
According to AngularJS documentation:
Causes $route service to reload the current route even if $location hasn't changed.
As a result of that, ngView creates new scope, reinstantiates the controller.
How to reload a page using Angularjs?
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
Angularjs re-render the whole page [ionic]
You could user following if you are using UI-Router on Ionic
$state.go($state.current, {}, {reload: true});
Or If you are using only Angular Routes, Use follwoing
$route.reload()
How to reload a page once using angular or javascript
I don't understand your use case but there is lot of way to make what you want.
I propose you a way with localStorage.
Check if a localStorage exist. By default the key don't exist, so you create it and reload the page too.
After the refresh you check the same key (that exist now). So you don't reload the page and remove the key for the next time
ngOnInit() {
if (!localStorage.getItem('foo')) {
localStorage.setItem('foo', 'no reload')
location.reload()
} else {
localStorage.removeItem('foo')
}
}
Related Topics
Jquery.Getjson - Access-Control-Allow-Origin Issue
Check If Jquery Has Been Loaded, Then Load It If False
Componentdidmount Equivalent on a React Function/Hooks Component
JavaScript Getelementbyid() Not Working
How to Test If a String Is JSON or Not
How to Iterate (Keys, Values) in JavaScript
How to Use Command Line Arguments in Angularjs Protractor
Can't Get Correct Return Value from an Jquery Ajax Call
Google Maps JavaScript API Referernotallowedmaperror
How to Upload a File Using Jquery.Ajax and Formdata
What Is Difference Between Axios and Fetch
Javascript: Check If Mouse Button Down
Why Can't I Update Props in React.Js
Automatic Semicolon Insertion & Return Statements
Remove All Special Characters Except Space from a String Using JavaScript
Get Loop Counter/Index Using For…Of Syntax in JavaScript
Javascript: Uncaught Typeerror: Cannot Call Method 'Addeventlistener' of Null