angular / router

The Angular 1 Component Router
MIT License
665 stars 135 forks source link

Alternative for classic $router.reload() #351

Open dolzenko opened 9 years ago

dolzenko commented 9 years ago

Classic router allowed to reinstantiate the controller with [0], how the same can be achieved with new router?

[0] https://docs.angularjs.org/api/ngRoute/service/$route#reload

bernfarr commented 9 years ago

I'd also like to know how to accomplish this. My initial page loads based on a REST call. If the user adds a search term via another part of the page I'd like to redo the REST call and reload the ngViewport. I've figured out everything except the reload part.

LMFinney commented 8 years ago

+1

LMFinney commented 8 years ago

I think I have figured this out. router.renavigate() will throw away the Component and rebuild it if the Component implements CanReuse (from 'angular/router') and returns false from the canReuse() method it overrides.

This works for me as of alpha 42.