$ stateprovider指的是什么状态?

时间:2015-07-02 14:49:46

标签: angularjs ionic-framework

我是Ionic和AngularJS的新手。 任何人都可以为我提供一个教程,它清楚地解释了$ stateprovider的语法,比如.state指的是什么,它的语法是什么。

在离子滑动菜单模板中

.state('app.single', {
url: "/playlists/:playlistId",
views: {
  'menuContent': {
    templateUrl: "templates/playlist.html",
    controller: 'PlaylistCtrl'
  }

我不明白app.single是指什么。

有人可以解释一下吗?

1 个答案:

答案 0 :(得分:0)

查看Angular UI Router

简而言之,如果您将其视为状态机,则状态是SPA的当前状态。

.state( 'app.single', { // app is the parent state, single is  a child state. 
         url: '/playlists/:playlistId', // This is telling the router what to display as 
                                        // the url in the browser window 
                                        // i.e. www.site.com/playlists/:playlistId
         views: { // Now we will assign the content of the various views
             'menuContent': { templateUrl: 'templates/playlist.html', 
                                        // This is telling the router where to find the 
                                        // HTML which it will insert into the menuContent
                                        // view. In essence this is what defines this
                                        // particular state
                              controller: 'PlaylistCtrl'} // This is telling the router
                                        // what controller to use for the content that was
                                        // inserted into menuContent
         }
      )