I have a configuration like below:
...
.state(\'profiles\', {
abstract: true
, url : \'/profiles\'
, resolve: {...}
, views: {
main
The solution could be found here: View Names - Relative vs. Absolute Names. A cite:
Behind the scenes, every view gets assigned an absolute name that follows a scheme of
viewname@statename, whereviewnameis the name used in theviewdirective and state name is the state's absolute name, e.g.contact.item
...
(note: in our case it must be'profiles').
The point is, that we can use the full (absolute) name of the view, being part of the current state definition:
$stateProvider
.state('profiles', {
url: '/profiles',
views: {
mainModule: {
template: '' +
' Main
' +
' ' +
'',
},
// here we do target the view just added above, as a 'mainModule'
// as
'leftSidePaneModule@profiles': {
template: '' +
' ' +
' ' +
'',
},
// and here we do target the sub view
// but still part of the state 'profiles' defined in the above
// view defintion 'leftSidePaneModule@profiles'
'leftWidgetOne@profiles': {
template: 'One2>',
},
'leftWidgetTwo@profiles': {
template: 'Two2>',
},
}
});
There is also plunker showing the above code in action
讨论(0)