2016-01-22 157 views
0

我的路線看起來像嵌套狀態URL不正確,具有角的UI路由器

$stateProvider.state("k8math", { 
    abstract: true, 
    url: "/k8math", 
    templateUrl: "/views/k8math.html" 
}).state("k8math.questions", { 
    url: "questions", 
    templateUrl: "/views/k8math/questions.html" 
}); 

當我有像一個鏈接: <li ng-hide="showLogin"><a ui-sref="k8math.questions">K-8 Math</a></li>它去http://localhost:3000/k8mathquestions而不是http://localhost:3000/k8math/questions

回答

2

你忘了你的URL中的斜線:

.state("k8math.questions", { 
    url: "/questions", 
    templateUrl: "/views/k8math/questions.html" 
}); 

嵌套狀態的網址是親戚,但不包括前導斜槓(example in docs)