grails create-ng-domain提供以下代码?
angular
.module("app.subscription")
.factory("LaunchSubscription", LaunchSubscription);
function LaunchSubscription($resource) {
var LaunchSubscription = $resource(
"api/launchSubscription/:id",
{"id": "@id"},
{"update": {method: "PUT"}, "list": {method: "GET", isArray: true}}
);
return LaunchSubscription;
}
在controller.js中,如何在调用$ save时处理错误?它目前看起来像这样。
launch.subscribe = function (){
launch.newSubscription.$save({}, function() {
launch.newSubscription = new LaunchSubscription();
launch.subscribed = true;
});
}