I am trying to download a file from server using window.open(path,'_blank','download') but it just opens it in a new tab. How do I download the file? Yes I did check for other similar question but none of them work. Also I've tried this but it didn't work.
$scope.docView = function () {     
    Method.getbyId("api call",docId).then(function(response) {                
        }).catch(function (data) {
            console.log("Unknown Error");
        });
    }
}
/*this.getbyId = function (path, id) {
            return $http.get(appSetting.apiBaseUrl + path + "/" + id);
        };
*/
[Route("api call")]
    [HttpGet]
    public IHttpActionResult ViewDocument (Guid? docId)
    {
          /*background work*/            
            response.Message = filePath;
            var bytes=System.IO.File.ReadAllBytes(prevPath);                
            HttpContext.Current.Response.Buffer = true;
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ClearHeaders();
            HttpContext.Current.Response.ContentType = value.Format;
            string Name = value.DocumentName;
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + Name);               
            HttpContext.Current.Response.BinaryWrite(bytes);
            }                
        }
        catch (Exception ex)
        {
            Utils.Write(ex);
        }
        return Ok(response);
    }
 
    