angularjs - Angular ui Router views not working -
my code ui router not working if set partial page view , name. please see code below.
html: using tab parent state.
<ul class="sidebar-nav"> <li> <a ui-sref=".timeline" name="timeline-tab"><div class="chap-title">chap1</div></a> </li> <li> <a ui-sref=".chap2" name="chap2-tab"><div class="chap-title">chap2</div></a> </li> </ul> <div ui-view></div>
and angular ui router:
//chap1 page .state('tab.timeline', { url: '/timeline', templateurl: 'partials/chap1_timeline.html', controller: 'timelinecontroller' }) //chapter 2 .state('tab.chap2', { url:'/chap2', views:{ 'chap2-tab':{ templateurl:'partials/chap2_scroll.html', controller:'chap2controller' } } })
the router chap1 works perfectly. it's not working chap2 when add view. dont know have missing according tutorial
the problem chap2 whole page content/controller not loading. no error msg, no content
why using name instead of "state"?
change code below , see if works.
//chap1 page .state('tab.timeline', { url: '/timeline', templateurl: 'partials/chap1_timeline.html', controller: 'timelinecontroller' }) //chapter 2 .state('tab.chap2', { url:'/chap2', views:{ '.chap2':{ templateurl:'partials/chap2_scroll.html', controller:'chap2controller' } } })
Comments
Post a Comment