I'm struggling with using the value that I got from a 'get' in my controller.

This is my code in my controller

```
vm.user;

function onInit(){
   loadUser(vm.queryParams.id[0]);
   console.log(vm.user);
}

function loadUser(UserId) {
    var defer = $q.defer();

    User.get({ id: userId }).$promise.then(function (user) {
        vm.user = user;
        defer.resolve();
    });

    return defer.promise;
};

```

When I print the `vm.user` in the `onInit()` it is undefined. While when I look on the view where vm.user is called it just shows me the correct values of the user. So it's not known after the `loadUser()` in the controller but it is in my view. 

I would like to first 'get' the user and then use it for further logic in the `onInit()`. How to retrieve the user properly so I can further use it and call its values in the `onInit()`?