First, I apologize if this is common Angular knowledge or has been covered 
here previously. I was struggling with this issue for a couple of 
afternoons and having no luck with Google, Github, etc. before resolving it 
myself through trial and error. I posted about the issue to reddit 
<http://www.reddit.com/r/angularjs/comments/345kzy/problem_using_google_apis_client_library_within/>
 
which I'll summarize here:

I'm writing a basic Gmail clone using Angular and the Google APIs 
JavaScript Client Library. Here's the flow of my application which led to 
the problem:

   1. Once gapi is ready, Angular prompts the user to log in using their 
   Google account via OAuth2.
   2. Once authenticated, the user is redirected to the /inbox 
   view/controller, where gapi.client.gmail.uesrs.messages.list is called 
   to retrieve their mail (successfully).
   3. If the user changes views/controllers (e.g. if I wanted to view my 
   /drafts)...
      - API calls to the gmail object do not work after the route change 
      (although the object and its methods still exist).
      - Other API calls (e.g. gapi.auth.getToken) continue to work as 
      expected.
   
Long story short, moving ng-view from the body to a div inside the body 
seems to have resolved the issue. I thought it may have had to do with some 
of my scripts (including the Client Library) being referenced from within 
the body (and therefore being removed whenever ng-view was updated) but 
moving these scripts into the head of the page and leaving ng-view on the 
body caused the same problem.

>
>    
> I'm curious to know whether or not this is a known caveat with Angular, 
and why it resulted in this behaviour. I'm not sure if it's a bug, 
necessarily, so I figured I'd ask here first before submitting a report on 
Github.

Any info on this topic would be appreciated. Thanks in advance!

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

Reply via email to