如何处理Grails ng-domain中的错误?

时间:2016-05-22 13:08:18

标签: angularjs grails

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;
    });
}

0 个答案:

没有答案