javascript - AngularJS Navbar UI-Router -


i creating angularjs application, , having trouble routes. i'm using ui-router , when clicking on different routes, page refreshes view was, not navbar outside .

does know how solve this? i'd site start @ top of page when route clicked on.

here route code:

.config(function($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise('/home'); $stateprovider     .state('home', {         url: '/home',         templateurl : 'views/home.html'     })     .state('work', {         url: '/work',         templateurl : 'views/work.html',         controller: 'workctrl'     })     .state('about', {         url: '/about',         templateurl : 'views/about.html'     })     .state('solution', {         url: '/solution',         templateurl : 'views/solution.html'     })     .state('contact', {         url: '/contact',         templateurl : 'views/contact.html',         controller: 'contactctrl'     })     .state('case_study', {         url: '/case_study',         templateurl : 'views/case_study.html'     })      }); 

my index file:

    <div ng-include src="'views/global/navbar.html'"></div>           <div ui-view></div>   <!-- footer --> <div ng-include src="'views/global/footer.html'"></div> 

maybe using ui-router 0.2.8 (or upper). if check release notes, you'll find this:

a much-requested feature: autoscroll attribute. adds autoscroll="expr" attribute uiview, nginclude has. replaces $anchorscroll call in uiview custom provider scrolls element attached uiview current view instead. should allow more fine-tuning designers scrolling automatically activate uiview without manipulating anchors. calling $uiviewscrollprovider.useanchorscroll() restore current behavior or calling $anchorscroll instead


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -