Skip to content

Backwards Compatibility

Tim Kindberg edited this page Aug 13, 2013 · 8 revisions

Full backwards compatibility with $routeProvider is not a primary goal this project. However, we are trying to have a clear migration path from $routeProvider to $stateProvider, and to use compatible terminology where this is possible and makes sense. At this point, most features of $routeProvider cleanly map to a sub-set of $stateProvider functionality, so that providing a compatibility shim that allows applications to be migrated bit by bit is feasible.

##ui.compat module

The ui.compat module should be used when you are migrating an existing angular application over to ui-router and you do not want to replace the current instances of ng-view and $route. ui.compat defines its own versions of ng-view and $route. They will behave just like the originals, but behind the scenes they will now be using ui-router internals. Then you can use $state and ui-view in new parts of your migrated application.

Note: The ui.compat module has ui.state as a dependency. So you are essentially loading the ui.state module and then ui.compat adds an compatibility layer on top of it that redefines ng-view and $route/$routeProvider.