Album->Tracklist<-Songs
I have 3 Models. I have this sort of relationship. Means Album is related with Song and Song again is related with has Many relationship using through Model Tracklist.
I wish to fetch records thats also I am succeeded, but it giving me error on console of $resource.badcfg. When I google its because I am expecting parameter as object and it is returning array. How to resolve this. I wish to find all records having this url. 'http://0.0.0.0:3000/api/Albums/60/songs'
Album.songs.
.findById({id: $stateParams.itemId})
.$promise
.then(function (data) {
$scope.detail = data;
});
You need pass success and error callbacks as params:
Album.songs.
.findById({id: $stateParams.itemId},
function(data) {
$scope.detail = data;
}, function(error) {
console.log(error)
})