how to change $routeParams without page reload? - angularjs

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.

Related

How do I refresh the current route?

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

Change browser title on route change in angular 1.5 component router

I am using angular 1.5 component router. I need to be able to change the title shown on the browser tab whenever there is a route change.
I have gone through the component router docs and googled it to many a websites but without any luck. The only way I can see to do it, is using vanilla JS inside each component's $onInit method.
I am looking out for an angular way of doing it and setting all the titles in one place. Please help.

ui-sref fires before loading the dynamic states. How to stop this?

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.

How to have angular reload the active state?

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()

Angularjs route with unchanged data, avoid re-rendering templates for controllers for that route?

If I am changing a route, and the data for that route has not changed, can I avoid re-rendering my templates for the controllers for that route?
thanks Stu. I don't think I need ui-router. I think my question was not simple enough (I simplified it just now) - sorry about that, and thanks again for your answer.
I actually can just use the reload on search feature. This does require me to change my urls, which isn't ideal, but it's an acceptable compromise to get what I want easily:
See: Can you change a path without reloading the controller in AngularJS?
1) If I am changing a route, and the data for that route has not changed, can I avoid re-rendering my templates for the controllers for that route?
I can't follow all of the details of your use case entirely, but you might want to look at ui-router. You can have nested states (glorified routes) and multiple views (templates) per state, which might help you to avoid reloading portions of the page.

Resources