I am trying to return data from $http.then function:
if(navigator.onLine){
    $http({
      method:'GET',
      url:url,
    }).success(function(data, status){
         localStorage.setItem('abc', JSON.stringify(data));
    }).then(function(){
      return JSON.parse(localStorage.getItem('abc'));   
    });
  }else{
    return JSON.parse(localStorage.getItem('abc')); 
  }
I am able to get the Json data from the else block but getting null value from the then function. 
And this function is inside a service.
 
     
     
     
    