0
각도 단일 페이지 응용 프로그램에서 작업. 나와 함께 문제는 사용자가 또는 직접 CATEGORY_ID을 통과하지 않을 경우URL의 매개 변수가 UI 라우터에서 null 일 수 없음
.state('one-category-product-list', {
url: '/products/:category/:category_id',
views: {
'': {
templateUrl: './view/single-category-product.html',
controller: 'ProductsController'
},
nav:{
templateUrl: function() {
if (authenticate() == 'customer') {
return './view/template/nav-login.html';
}
return './view/template/nav.html';
}
},
footer:{
templateUrl: './view/template/footer.html'
}
}
})
내가 이것을 시도하고 은 ... www.example.com/product/category/처럼 마지막 매개 변수없이 URL을 입력 그런 다음 매개 변수 category_id : ""를 사용합니다. 이것을 제한하는 방법.
그래서 당신은 상태 변경을 방지하려면? – Korte
예, 그렇지 않은 경우 상태로 리디렉션됩니다. –