restangular post return value is undefined
I use restangular to create albums,
createAlbum:function(obj){
albumlist.post(obj.data).then(function(res){
console.log(res)
obj.success(res)
},function(err){
obj.error(err)
})
}
and I call the service like this
$scope.createAlbum = function(){
albumService.createAlbum({
data:$scope.newalbum,
success:function(data){
$scope.albumlist.push(data)
},
error:function(err){
alert('error'+err.status)
}
})
}
but after the album successfully posted the console.log(res) always
undefined , any thing wrong with my code?
No comments:
Post a Comment