angularjs - How to set a Nested view inside a multiple views -
i've 2 named views , unnamed view follow:
//department.html <div class="col-md-2"> <div ui-view="sidebar"></div> </div> <div class="col-md-10"> <div ui-view="content"></div> <div ui-view></div> </div>
and routes:
.state('support', { url: '/support', views: { '': { templateurl: 'app/components/department/department.html' }, 'sidebar@support': { templateurl: 'app/shared/sidebar/sidebar.html', controller: 'sidebarcontroller' }, 'content@support':{ templateurl: 'app/components/department/support/partial-support.html', controller: 'supportcontroller' }, } }) .state('support.view', { url: '/view', template: '<b> hi there nested!!</b>' });
what need :
localhost/support
: parent url, in url 2 named views injected(sidebar , content) works me.localhost/support/view
: in router want child view replacecontent
view or replace both multiple views.
the problem is: can't nested view working, i'm doing wrong?
ps: i've read ui-router doc , see other questions can't find similar scenario.
your scenario working when not having html5mode enabled. there a working plunker.
i used these links:
<a ui-sref="support"> <a ui-sref="support.view">
and state - works.
in case, have html5mode enabled, must configure server. this updated plunker shows, working again, html5mode enabled
$locationprovider.html5mode({enabled: true});
check version
Comments
Post a Comment