LoopbackJS: HasAndBelongsToMany, how to query/filter by property of relation?

后端 未结 2 447
广开言路
广开言路 2020-12-21 15:24

I\'m currently working on my first Loopbackjs project and am facing a seemingly simple issue: Let\'s say I have a model \"Post\" and a model \"Tag\". A Post has and belongs

2条回答
  •  轮回少年
    2020-12-21 15:54

    I've come here with the same issue, but after some research I got to this solution.

    I'm gonna use an example: model Provincias hasAndBelongsToMany Cantones.

    In order to get: /api/Provincias/1/cantones

    You can use in your Angular code:

    Provincias.cantones({'id': 1});

提交回复
热议问题