Approach 1
$urlRouterProvider when() .
app.config(function($urlRouterProvider){
$urlRouterProvider.when('/single/:id', ['$match', '$state', function($match, $state) {
if($match.id === ""){
$state.transitionTo("app.list");
}
}
]);
});
: http://plnkr.co/edit/sEoUGGCEge0XbKp3nQnc?p=preview
2
param controller
myApp.controller('MainCtrl', function($state, $stateParams) {
if($state.current.name == 'app.single' && $stateParams.id === ""){
$state.transitionTo("app.list");
}
});
: http://plnkr.co/edit/QNF1RHy4Prde4CRhNLFa?p=preview
. , app.single. , , app.single param. main, without param of single state. list.