2016-08-01 73 views
0

我的$ urlRouterProvider.otherwise();

當在android上模擬時,應用程序啓動的藝人狀態,而不是歡迎。

我看不出問題出在哪裏。

app.config(['$stateProvider', '$urlRouterProvider', '$ionicConfigProvider', '$sceDelegateProvider', function($stateProvider, $urlRouterProvider, $ionicConfigProvider, $sceDelegateProvider){ 

    $stateProvider.state('welcome', { 
     url: '/welcome', 
     templateUrl: 'templates/welcome.html', 
     controller: 'WelcomeCtrl' 
    }) 

    .state('user',{ 
     url:'/user', 
     templateUrl: 'templates/user.html', 
     controller: 'UserCtrl' 
    }) 
    .state('settings',{ 
     url:'/settings', 
     templateUrl: 'templates/settings.html' 
//  controller: 'SettingsCtrl' 
    }) 
    .state('artists',{ 
     url:'/artists', 
     templateUrl: 'templates/artists.html', 
     controller: 'ArtistsCtrl' 
    }) 
    .state('artist',{ 
     url:'/artists/:artistId', 
     templateUrl: 'templates/artist.html', 
     controller: 'ArtistCtrl' 
    }) 
    .state('search',{ 
     url:'/search', 
     templateUrl: 'templates/search.html', 
     controller: 'SearchCtrl' 
    }); 

    $urlRouterProvider.otherwise('/welcome'); 

}]); 

感謝您的幫助!

+0

您是否收到任何錯誤? – Gary

+1

你有沒有設置你的模擬器以'/ artists'啓動? – Phil

+0

我沒有錯誤@加里 –

回答

0

嘗試使用

$stateProvider 
.state("welcome", { url : '/welcome'}) 
+0

我有一個錯誤: 錯誤:'規則'必須是一個函數 –

+0

我已經更新了答案檢查現在。 –