Hello, i’m using Ionic side menu https://github.com/driftyco/ionic-starter-sidemenu , and i follow this formula http://learn.ionicframework.com/formulas/sharing-data-between-views/ for my static data. I’m having trouble to link my single page.
First level i show a list with all categories, then i show the items that belongs to the category clicked, now i want to show the single item.
This is my plunker: http://plnkr.co/edit/6pqT0F?p=info
Someone help me please. I tried a lot of things. I’m new to angular/ui router/ionic services/etc
EDIT: I got help on stackoverflow http://stackoverflow.com/questions/29370032/angularjs-ui-router-sharing-data-between-views so i updated the plunker if anyone is interested.
your routes should like this
.state('app.playlists', {
url: "/playlists",
views: {
'menuContent': {
templateUrl: "playlists.html",
controller: 'PlaylistsCtrl',
resolve: {
playlists: function(PlaylistsService) {
return PlaylistsService.getPlaylists()
}
}
}
}
})
.state('app.playlists.playlist', {
url: "/:playlistId",
views: {
'menuContent': {
templateUrl: "playlists.playlist.html",
controller: 'PlaylistCtrl',
resolve: {
playlist: function($stateParams, PlaylistsService) {
return PlaylistsService.getPlaylist($stateParams.playlistId)
}
}
}
}
})
.state('app.playlists.playlist.single', {
url: "/:singleId",
views: {
'menuContent': {
templateUrl: "playlists.playlist.single.html",
controller: 'SingleCtrl',
resolve: {
single: function($stateParams, PlaylistsService) {
return PlaylistsService.getSingle($stateParams.singleId)
}
}
}
}
});
then you need to change templates to handle correct ui-sref
elSolo
March 25, 2015, 3:18pm
5
WOW you use http://code.ionicframework.com/1.0.0-beta.1 ?
Please come back in 2015 marty
http://code.ionicframework.com/#
And I don’t understand where are your “singles” data in your PlaylistsService ?
Hello @bobrov1989 , thanks for answer!
So, in my playlists.playlist.html i put ui-sref=“app.playlists.playlist.single({singleId: single.id })” is this correct?
The following log: Error: Could not resolve ‘app.playlists.playlist.single’ from state ‘app.playlist’
@elSolo this is just for demo purpose… i just fork it.
First level i show a list with all categories, then i show the items that belongs to the category clicked, next i want to show only the single item. tks