I have a piece of code that I only seem to be able to access inside of then
. I would like to get access to it outside so that I can use it in other places.
$scope.model = {'first_name':'','last_name':'','email':'',};
djangoAuth.profile().then(function(data){
$scope.model = data;
console.log($scope.model); //this prints the data
});
console.log($scope.model); //this prints empty data
The profile
code is like this:
'profile': function(){
return this.request({
'method': "GET",
'url': "/user/"
});
}