Я новичок в Ionic и AngularJS. Может ли кто-нибудь предоставить мне учебное пособие, в котором четко объясняется синтаксис $ stateprovider, как то, на что ссылается.state и каков его синтаксис.
В шаблоне меню ионного скользящего меню
.state('app.single', {
url: "/playlists/:playlistId",
views: {
'menuContent': {
templateUrl: "templates/playlist.html",
controller: 'PlaylistCtrl'
}
Я не понимал, что такое app.single.
Может кто-нибудь объяснить?
Посмотрите на Угловой UI-маршрутизатор
Короче говоря, состояние - это текущее состояние 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
}
)