Any ideas on how to work my backend relationships in Angularn5 (frontend)?
I have DjangoRest as a backend and I am using Angular5 as a frontend, and I get the data through http in json format, but I have the problem when dealing with backend relationships, since the json lists each table and through code that I do I have to preseantar the data.
This is a simple sample of my problem:
And to present in the view I have to compare the 3 lists obtained from the 3 tables.
Is there any code that Angular autogenerates for this? Is there any more efficient way?
This I use in my service.ts
getActividades(): Promise<Actividad[]> {
return this.http.get( 'http://localhost:8000/actividad?format=json{headers: this.headers})
.toPromise()
.then(response => response.json() as Actividad[])
}
and the json returns to me:
[{"id":2,"nombre":"¿Qué es la Dirección de Proyectos?","objetivo":"","descripcion":"Ver video de lo que es la dirección de proyectos.\r\n\r\nLink del video: https://www.youtube.com/watch?v=MlyrriEzx3o","entrega":"","fecha":"2018-10-24","aprobado":false,"en_revision":true,"hecho":false,"documento_adjunto":"","metodologia":{"id":2,"nombre":"Tradicional","descripcion":"sin definir","timestamp":"2018-10-08T18:16:58.020307Z","lastModification":"2018-10-08T18:16:58.020307Z"},"competenciaspropuestas":["Éxito en la Dirección de Proyectos: 1","Cambios: 2"],"resultadosaprendizajespropuestos":["Formular y evaluar proyectos de tecnologías de información: Básico"],"timestamp":"2018-10-08T18:56:43.729047Z","lastModification":"2018-10-25T18:25:57.419596Z"},{"id":3,"nombre":"EDT","objetivo":"Comprender y aplicar la herramienta EDT en un proyecto simple","descripcion":"Realizar EDT del desarrollo de una app móvil para hacer compras de artículos gamer PC","entrega":"En papel, durante la clase - 20 minutos para desarrollarlo","fecha":"2018-12-28","aprobado":true,"en_revision":false,"hecho":false,"documento_adjunto":"","metodologia":{"id":2,"nombre":"Tradicional","descripcion":"sin definir","timestamp":"2018-10-08T18:16:58.020307Z","lastModification":"2018-10-08T18:16:58.020307Z"},"competenciaspropuestas":["Estructuras de proyectos: 4","Alcance y entregables: 4","Tiempo y fases de los proyectos: 4"],"resultadosaprendizajespropuestos":["Administrar y gestionar proyectos informáticos: Avanzado"],"timestamp":"2018-10-23T15:10:47.497599Z","lastModification":"2018-10-23T15:10:47.497599Z"}]
And so with the 3 tables ... then I compare the json IDs of the "Activity" and the "CompetenceProposal" to then compare it with the json of the "Competition" and get the name of the "Competition" which corresponds to the "Activity" ....
Thanks for the help!