angularjs: how to add caching to resource object?

后端 未结 8 667
栀梦
栀梦 2020-12-02 08:08

To add caching inside http is pretty straight forward. ( by passing cache=true )

http://docs.angularjs.org/api/ng.$http has Cache option.

How do I add simila

8条回答
  •  离开以前
    2020-12-02 08:52

    This doesn't seem to be mentioned here but you can also overwrite the default methods.

    app.factory("List", ["$resource", function($resource) {
        return $resource("./lists/:path/:action.json", {}, {
            get: {
                method: "GET",
                cache: true
            }
        });
    }]);
    

提交回复
热议问题