0

我正在使用 Angular js 向 API 发出 POST 请求。我需要发送一些标题和音频文件。我已经在控制器中编写了相同的示例代码。

    $scope.files='bostonSeltics.wav';
    $scope.getText = function (access_token) {$http({method:'POST',
    url:'https://api.att.com/rest/1/SpeechToText',      
    headers:{
    'Accept':'application/json',
    'Authorization':'Bearer '+access_token,
    'X-SpeechContext': 'Generic',
    'Content-Type':'audio/wav'},
    data:$scope.files}).success(function(response){
    ......
      }).error(function(error){
    ......
    });

我只是想知道这种发送音频数据的方法是否正确。

提前致谢。

问候,莫汉

4

1 回答 1

0

使用 Angular js 文件上传指令,它比http..ng-file 上传更容易上传 ,如果你可以在工厂内编写,我会更好,它会提高可重用性

于 2014-01-09T15:29:31.507 回答