我正在尝试从$http.then函数返回数据:
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')); 
  }
我能够从else块中获取 Json 数据,但从函数中获取null值。then
这个功能在一个服务里面。