Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我使用查询字符串向服务发出 GET 请求时/restaurants?includeData,默认情况下includeData用于过滤给我零结果的餐馆。
/restaurants?includeData
includeData
如何避免在过滤中使用此特定查询字段,以便我可以在挂钩中将其用于我自己的目的?
您可以创建另一个before挂钩,将hook.params.queryandhook对象修改为您需要的对象:
before
hook.params.query
hook
app.service('myservice').before(function(hook) { hook.includeData = hook.params.query.includeData; delete hook.params.query.includeData; });