When I'm on a state/route say #/users and I click on a link that goes the the exact same state/route, it does nothing, I would like to have this state reload.
If you are using ui-router you can user
$state.reload()
Related
I am developing an app in NativeScript with Angular
When I want to navigate to another route I simply programmatically declare:
this.router.navigate(['/my-details']);
However, when I am on the my-details route and I want to refresh the route.
I have tried calling the route again with the same method as above, as adding a parameter to the route such as /refresh, but they both do not work.
How do I refresh/navigate to the current route?
Couldn't you just use pullToRefresh? Although you have a detail view and not a list view it is possible to implement it there: https://github.com/bradmartin/nativescript-pulltorefresh#html
I would like to make my app change state when I'm refreshing my browser but not when I'm just refreshing my states.
How can I do it?
In the run function for the application you can call
$state.go('home'); // whatever state
and it will result in the app always going to the home state when you hit the refresh button. Run is only executed when the app is loaded not on state changes.
Hi I am trying to load states dynamically through an ajax request in the app.run() method.
In the same page, I have a link with ui-sref pointing to this dynamic state.
While loading the page, the ui-sref fires before this load and says state not found.
Any trick how we can overcome this?
Don't retrieve the states in app.run. Only bootstrap your app after the ajax request is returned.
I'm encountering a reload problem with ui-router.
My navbar links to a submitForm page:
<a ui-sref=".submitForm">
submitForm can also take parameters, if someone is trying to edit a previously created form. The navbar should always link to a no parameters version.
However, if I'm on a version with parameters, then the navbar just reloads the page with the same parameters.
Any idea why or how I can fix this? Thanks!
I need to change some URL variables without page reload, I have set the $routeParams's value but this doesn't change in the navigation bar.
Does someone can help me ?
I'm not aware of a pure angular way to do this, but Angular UI Router allows you to assign urls to states and when you transition between states, it will rewrite the URL without a page reload.