You are a Saviour, Man. Thanks a lot.

On Wednesday, September 10, 2014 8:03:15 PM UTC-7, Sander Elias wrote:
>
> Hi Christian,
>
> It will be available once it comes back from the server. If you have code 
> that can’t execute before something is available, you
> have to put it inside a .then().
>
> something like this:
>
> var resultIsIn = $http.get('/url').success(function(data){
>            $scope.result = data;
>            console.log($scope.result) //log 1
>    })
>
> resultIsIn.then(function () {
>    console.log($scope.result) //log 2
> });
>
> In JS you have to deal with asynchronous events! Angular makes it
> easier for you with promises. ($q) 
> <https://docs.angularjs.org/api/ng/service/$q>
>
> 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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to