angular-ui/ui-router — pull request #389 by adrianhara (2013-09-06 12:52:36+00:00)
Title: Dynamic controller selection and replace browser previous history entry when navigating

Hi guys,

I've done two changes:
- added optional "controllerFactory" property to views: it should be function that'll get called with $stateParams as argument and it can return the name of the controller to use; basically allow dynamically choosing the controller for a view; I submitted this before, there was a discussion and in the end it was closed because of lack of activity, however it would be really great if it could be added as we're using it heavily and it's opt-in, so no harm done theoretically.

- added optional "replacePreviousHistoryEntry" parameter to state navigation options: if set to 'true' (default 'false') then the navigation will replace the previous browser history entry. A use-case for this would be when you have a state for an "add" screen and on "save" on that screen you navigate to a "details" state. However, if then the user goes back in the browser he'll end up on the "add" screen again, which might not be ideal: using this parameter as 'true' will cause the back navigation to actually go to the previous page (i.e. before the "add" screen).

Thanks for considering them!