解决方法
使用UI路由器
resolve检查路由参数是否丢失.
//Example of a single route .state('dashboard',{ url: '/dashboard/:userId',templateUrl: 'dashboard.html',controller: 'DashboardController',resolve: function($stateParams,$location){ //Check if url parameter is missing. if ($stateParams.userId === undefined) { //Do something such as navigating to a different page. $location.path('/somewhere/else'); } } })