I'm using AngularJs Rails Resouce and was wondering if there was a callback for when you successfully create/update a resource using the create() or update() methods.
For instance, here's my code:
$scope.createPage = function () {
var page = new Page({
title: $scope.pageTitle,
content: $scope.pageContent,
published: true
});
if (page.create()){
$scope.showAlert('Page created successfully', 'success');
} else {
$scope.showAlert('There was a problem creating the page.', 'warning');
}
}
But that doesn't work. Even if the API is not available, the success message is created.
Any ideas?