Closed MitkoTschimev closed 8 years ago
Hi @tfiwm You should be able to use the normal loopback relationship filter using include. Just put it inside the function call.
Julian
Hi @dmastag
thx for the quick answer :) can you give me a link with an example. This would be great! Thank you very much!
Hi,
you can go to the wiki page https://github.com/mean-expert-official/loopback-sdk-builder/wiki/5.-Usage-Examples
and check the getRoom in the real time app
`getRoom(id: any): void {
this.roomApi.findById(id, {
include: [
{
relation: 'messages',
scope: { order: 'id DESC' }
}
]
}).subscribe((room: Room) => {
this.room = room;
this.roomApi.onCreateMessages(this.room.id)
.subscribe((message: Message) => this.room.messages.push(message))
});
} `
thx a lot!
Hey Guys, Thanks for reaching and jumping in to the question.
I'm glad this is starting to feel like wider community.
Cheers!!! Jon
What type of issue are you creating?
What version of this module are you using?
Write other if any:
Please add a description for your issue:
Hello,
how can i use relations in the typescript code? Can you give me an example e.g. with "Belongs To"?
Best regard