0

I would like

{{user.EMAIL}}

to show up as my email in my account.html view.

Right now my splash controller gets the information from google oAuth and that all works fine.

In my service I do:

.factory('UserService', function($http) {

var user = {
    EMAIL: false,
    FULLNAME : false,
    FIRSTNAME : false,
    LASTNAME : false,
    PICURL: false,
    GENDER: false
}

user.getInfo = function(token) {
    $http.get('https://www.googleapis.com/oauth2/v2/userinfo?alt=json&access_token=' + token).
    success(function(response){
        user.EMAIL = JSON.stringify(response.email);
        user.FULLNAME = JSON.stringify(response.fullname);
        user.FIRSTNAME = JSON.stringify(response.given_name);
        user.LASTNAME = JSON.stringify(response.family_name);
        user.GENDER = JSON.stringify(response.gender);
        alert(user.EMAIL);
    }).
    error(function(){
        alert("Error!");
    })
}
return user;

my controller has the service as a dependency so I can't imagine why it's not displaying in my account.html view. The alert(user.EMAIL) works fine too.

  • possible duplicate of [How to return the response from an asynchronous call?](http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-asynchronous-call) – Matthew Green Jul 06 '15 at 18:50
  • Could you please prepare a plnkr? Would be way better to help you then. It is of interest how you reference your service in your controller and what your HTML looks like. Take http://plnkr.co/edit/tpl:nKLNBdve51sqOoKZAOUS as a starting point. – ilmgb Jul 06 '15 at 19:03
  • 1) have you actually called getInfo? 2) How do you assign user to scope – vvondra Jul 06 '15 at 19:05
  • 1
    in order to answer this question, we would need to see the controller, and the HTML related to the property that isn't rendering. – Claies Jul 06 '15 at 19:19

0 Answers0