I would say, your SPA (single page application) will have to always reach the index.html
first (related to your prev question). The rest is done by angular, by UI-Router - but all will and must start at index.html
And the we can use UI-Router
settings of the $urlRouterProvider
. The way how to achieve that is described here:
so basically we can use .when()
var whenConfig = ['$urlRouterProvider', function($urlRouterProvider) {
$urlRouterProvider
.when('/app/list', ['$state', 'myService', function ($state, myService) {
$state.go('app.list.detail', {id: myService.Params.id});
}])
.otherwise('/auth/content');
}];
...
app.config(whenConfig)
but the version 2.0.13 has some issues and the solution is described here:
Where is shown that we have to use some fix for .when()
like:
var onChangeConfig = ['$rootScope', '$state',
function ($rootScope, $state) {
$rootScope.$on('$stateChangeStart', function (event, toState) {
if (toState.name === "app.list") {
event.preventDefault();
$state.go('app.list.detail', {id: 2});
}
});
}]