I am trying to create a directive whose controller makes calls to an API using $resource. When I load the app, the view contains no data (understandable, since the $resource promise has not yet resolved). In the controller I am waiting for the promise to resolve (using .then) and then updating the data object. However this doesn't cause the view to update.
I have added a manual 'update' button that re-runs the controller's update method, and this causes the api to be re-queried and the view to update - however the view updates to show the previous query's data. (The console log and query results show the discrepancy in the value of 'count'). I'm fairly sure this is me not handling the asynchronous calls correctly, but I'm not sure what else I could be doing to fix this? The code is here: http://codepen.io/anon/pen/xGzQEd Any suggestions or solutions greatly appreciated! Matthew -- 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 http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
