我目前正在創建一個angularjs應用程序,並且遇到了我的路由問題。我使用的是UI-Router,當點擊我的不同路線時,頁面會刷新視圖的位置,而不是導航欄位於視圖外的位置。AngularJS Navbar UI-Router
有誰知道如何解決這個問題?當點擊路線時,我真的很喜歡該網站從頁面頂部開始。
這裏是我的路線代碼:
.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'
})
});
我的索引文件:
<div ng-include src="'views/global/navbar.html'"></div>
<div ui-view></div>
<!-- FOOTER -->
<div ng-include src="'views/global/footer.html'"></div>
嘗試將數據自動滾屏=「假」到你的用戶界面視圖股利。 – aet