1

状态

.state('event.detail', {
    url: '/:id',
    views: {
        'event-detail': {
            controller: EventDetail,
            templateUrl: ...
        }
    }
})
.state('event.detail.info', {
    url: '/info',
    views: {
        'event-info': {
            templateUrl: ...
        }
    }
})
.state('event.detail.map', {
    url: '/map',
    views: {
        'event-map': {
            templateUrl: ...
        }
    }
})

ui-sref

<a ui-sref="event.detail({id: event.id}).map">Map</a>

这给了我一个Invalid state ref错误。

4

1 回答 1

1

你快到了......首先是状态名称,然后是传递的参数对象

// instead of this
<a ui-sref="event.detail({id: event.id}).map">Map</a>
// create this
<a ui-sref="event.detail.map({id: event.id})">Map</a>

某种类似 的问答,我在其中创建了这个 plunker,它应该表明一切都在行动(即使父母有参数,孩子也有自己的)

于 2016-05-10T14:01:47.200 回答