OK Sander,

you were right. It was the Coffee Script.

I was able to fix this by adding a return in the Coffee Script:

angular.module('jewelsStore')
  .controller('JewelsCtrl', [ "JewelsResource", (JewelsResource) ->
    this.jewels = JewelsResource.getAll()
    return
  ])

I was unaware that a return with no target suppresses an automatic 
generation of a return
statement in coffee script.

A return statement is not allowed on a promise, so that is what was 
breaking it.

The console.log statement was getting returned when I added that, so it 
worked fine.
I replaced console.log with a random $scope statement, which got returned 
and that also
worked. At that point I realized I was being done in by the automatically 
generated return
statement, did some research to find out a return with no target is just 
removed.

Thanks for the reflection that got me on the right track!

On Monday, July 11, 2016 at 11:20:45 PM UTC-7, Sander Elias wrote:
>
> Hi Jerry,
>
> Well, I still believe the issue you are having is a coffeescript one. You 
> see, Restangular.all('jewels').getList().$object returns a empty array. 
> Then it goes off and does its job, and once the results are in, the array 
> is extended with the result. You see this reflected in the console. 
> (logging to the console gives a 'live' presentation of an object/array, not 
> an point in time display. You first you log out an empty array, which then 
> is filled once the results come in. that is why the console log is working 
> for you. I suspect your use of coffee-script breaks this reference somehow.
>
> Regards
> Sander
>

-- 
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.

Reply via email to