I have the following problem, I create the user and add the same in a course. I just can not return the course name on the user page. The course is added via select input, sending only the ID of the course. When I return via
{{user.curso}}
It returns _id: "5b38e3bc9dbf9113560a2d4c".
I tried to create a pipe and filter by user. course, but it also did not work. You have not returned any information.
@Pipe({
name: "filter",
pure: false
})
export class ArrayFilterPipe implements PipeTransform {
transform(items: Array<any>, conditions: {[field: string]: any}): Array<any> {
return items.filter(item => {
for (let field in conditions) {
if (item[field] !== conditions[field]) {
return false;
}
}
return true;
});
}
}
<div class="content" *ngFor="let curso of cursos | filter:{user:user.curso}">
<li>{{curso.title}}</li>
</div>
Can anyone give me a hint?