I have the following states in my ui-router state provider:
$urlRouterProvider.when('/parent', '/parent/child');
$stateProvider.state('parent', {
url: "/parent",
abstract: true
});
$stateProvider.state('parent.child', {
url: "/child"
});
Which follows the best practice for having a default child state as explained here in the ui-router docs.
However, when I now include a link in my document somewhere referencing parent with ui-sref
such as <a ui-sref="parent">Link</a>
I always get an error saying I cannot transition to an abstract state. When I enter the URL manually into the address bar and hit enter everything works fine.
Related Plunker: http://plnkr.co/edit/d3Z0tOwC3VCTPqGiB0df?p=preview
How can I combine ui-sref
with default child states?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…