-2
- 我正在第一次在AngularJs中使用路由工作,而且我現在有一段非常困難的時間,因爲我改變了文檔,先開始工作,然後沒有。那麼我做錯了什麼?我也爲應用程序使用ui路由。
- 所以現在是我的問題。什麼是讓這個工作的最佳選擇。
- http://embed.plnkr.co/QtM3ucPn6R1cPgdPjEzp/這是我製作路由應用的plnkr。
angular.module('helloworld', ['ui.router'])
.config(['$stateProvider','$urlRouterProvider',function($stateProvider,$urlRouterProvider){
$stateProvider
.state('home',{
url : '/home',
templateUrl : 'home.html'
})
.state('about',{
url : '/about',
templateUrl : 'about.html'
})
$urlRouterProvider.otherwise('/home');
}])
有在你的代碼的小失誤。你對配置文件使用了錯誤的語法。遵循最佳實踐。我有工作plunkr ..這是無錯配置。希望這會幫助你