var ecm = '';
$http.get('v1/xys/')
              .success(function(res){
                if($route.current.$$route.controller == 'historial')
                 {
                  return ecm = {
                    'cc' : cc,
                    'purchase' : {
                      'field' : field,
                        'prd' : result
                   }
                  }  
                 }else{
                  return ecm = {
                    'purchase' : {
                      'field' : '',
                        'prd' : []
                   }
                 }
                }
              }).error(function(err){
              })
console.log(ecm);
//how can i access the ecm object outside http request. I did return but does not work is there any other process to come over this issue. please guide thanks a ton in advance.
 
    