我想在 $ resource构造url 之前以编程方式更改路由参数.我无法使用angular的http拦截器来执行此操作,因为此时路由已经连接在一起.
给出一个Assortment.model.js
module.exports = function($resource) { return $resource("", {}, { get: { url: "/assortment/:model/:id", method: "GET", params: {id: "@id", model: "@model"} //< this needs to be uppercase } }); };
......和一些controller.js
["Supplier", function(Supplier) { Supplier.Assortment.get({ id: 5, model: "user" }) }]
如何强制执行始终转换{model: "user"}
为的挂钩{model: "User"}