2

Freaking RESTful API's.
Never worked with one before and I'm using Django Rest Framework.
Currently working (trying to) with Angular 2.
Spent lots of time trying to make angular work because ng needs arrays instead of objects when I finally realized it was a matter of the API.
Have no idea what I'm doing

Comments
  • 0
    Django Rest framework is great! Serializers should help to represent the data the way angular can digest. Also, Should you not also be able to process your objects and flatten them to arrays in the angular controllers? Double also, isn't an array in JavaScript simply a numerical indexed object as JavaScript can be either object or array notation. foo.bar is the same as foo["bar"].
  • 0
    @avstuff all I know is an error saying it can't work with [object object] of type Object (wtf)
    I'm new at Javascript, Typescript, Angular 2, Python, Django and Django Rest.
    All the time I can spend on the project is 3 hours a day and anything I do not know is a thing I need to spend more than a little to learn.
    Bad thing is I feel sad because being at college, there's no teacher nor course which teach me all that.
    Good thing is I'm allowed to spend time learning all that. And of course, I enjoy it as hell
  • 1
    I didn't realize typescript was involved. I do not have any experience with a strong typed js, I wonder if this might be the reason for the errors. Introducing typing into js might force you to change the output of the rest framework or utilize the controller as an object to array step. Manually creating the output from Django rest would defeat many of the wonderful things the Django rest can do for you though. A better option might be to simply find out what angular options are available for digesting an object.
  • 0
    I'm curious, could you provide a snippet of what is throwing the error?
  • 0
    Of course. I will tomorrow, cause I don't have access to the code right now.
Add Comment