Hello! I solved my problem. I have a directive that was removing the contents of the roles array, so now I have to fix that :P.
Thanks everyone for reading! El martes, 12 de enero de 2016, 20:21:17 (UTC-3), Nicolás Mancilla escribió: > > I made a mistake. > > The > > copy.data.account.roles > > can be empty too. > > Thanks! > > El martes, 12 de enero de 2016, 13:21:14 (UTC-3), Nicolás Mancilla > escribió: >> >> Luís, >> >> Now I'm certain that there are not async responses. >> >> I made some other tests: >> >> 1. Put a breakpoint in angular-resource.js (where the response is >> executed) and the *response.data* contains all the expected *roles*. >> 2. Put another breakpoint in angular.js, in >> $http(config).transformResponse (private method) and, again, the response >> (without parsing) is complete (the roles are present). >> 3. Inside the httpInterceptor, if I do an angular.copy of the response >> object, the roles array is filled: >> >> var copy = angular.copy(response); >> // copy.data.account.roles.length > 0 = true >> // response.data.account.roles.length > 0 = false >> >> In the first 2 tests, the responses contains the expected data, but, >> weird enough, in the UI (and the interceptor) the roles array is empty. >> >> Thanks for your answers! >> >> El martes, 12 de enero de 2016, 11:53:15 (UTC-3), Nicolás Mancilla >> escribió: >>> >>> Hi Luís! >>> >>> I'm almost certain that async responses are not being used (yet), but >>> I'll make some tests and report back. >>> >>> Thanks for your answer! >>> >>> El lunes, 11 de enero de 2016, 8:53:00 (UTC-3), Luís Loureiro escribió: >>>> >>>> Hi Nicolás! >>>> >>>> Your Angular Code seems perfectly fine, I can't figure out anything >>>> wrong in it. >>>> >>>> In spite of you saying that >>>> >>>> I'm sure that the *roles* array is not empty, because when I inspect >>>>> the data in the Developer Tools (Google Chrome, Network tab), the >>>>> response >>>>> contains all data. Even in the API logs (on the server side) the >>>>> *roles* array is not empty. >>>> >>>> >>>> are you sure you're not using an asynchronous job getting the account >>>> roles in the server-side and sending the response before getting this data? >>>> >>>> Regards, >>>> *Luís Loureiro* >>>> >>> -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
