I think this is just basically a question of syntax, but I have this routing set up:
app.config(['$stateProvider', function ($stateProvider) {
$stateProvider.state('addAlbum', {
url: "/albums/create/:artistId",
templateUrl: "public/albums/views/album.tpl.html",
controller: "createAlbumController",
data: {
pageTitle: 'Create Album'
},
resolve: {
albums: function (publicArtistServices) {
return publicArtistServices.getAlbums(1);
}
}
});
}]);
And I need that getAlbums() method to use the artistId passed in on the URL:
return publicArtistServices.getAlbums({need artistId from URL here});
I tried guessing at it by using return publicArtistServices.getAlbums($state.params[0]); but that just threw a "$state is not defined" error.
What's the right syntax here?