我正在使用AngularJS 1.6.4,我收到有关 $ sce 的错误:
错误:[$ sce:itype] http://errors.angularjs.org/1.6.4/ $ sce / itype?p0 = html Trace de la pile : L /< @ https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:6:425 trustAs @ https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js:155:46 [...]
主要控制器
(function(angular) {
'use strict';
angular.module('fooModule')
.controller('MainCtrl', ['$scope', '$q', '$http', '$sce', function ($scope, $q, $http, $sce){
...
$q.all([
...
]).then(function(responses) {
$scope.send = function(){
var data = {
...
};
$http({
url: 'file.php',
method: "POST",
data: $.param(data),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).then(function successCallback(response) {
$scope.dataResponse = $sce.trustAsHtml(response);
}, function errorCallback(response) {
console.dir(response);
});
}
};
});
...
}]);
})(window.angular);
我不明白这个错误是什么意思。有人可以解释一下吗?我该如何解决?
答案 0 :(得分:3)
HRESULT MediaTypesFactory::CopyAudioTypeBasicAttributes(IMFMediaType * in_media_type, IMFMediaType * out_mf_media_type) {
HRESULT hr = S_OK;
static const GUID AUDIO_MAJORTYPE = MFMediaType_Audio;
static const GUID AUDIO_SUBTYPE = MFAudioFormat_PCM;
out_mf_media_type->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, AUDIO_BITS_PER_SAMPLE);
WAVEFORMATEX *in_wfx;
UINT32 wfx_size;
MFCreateWaveFormatExFromMFMediaType(in_media_type, &in_wfx, &wfx_size);
hr = out_mf_media_type->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, in_wfx->nSamplesPerSec);
DEBUG_ON_FAIL(hr);
hr = out_mf_media_type->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, in_wfx->nChannels);
DEBUG_ON_FAIL(hr);
hr = out_mf_media_type->SetUINT32(MF_MT_AUDIO_AVG_BYTES_PER_SECOND, in_wfx->nAvgBytesPerSec);
DEBUG_ON_FAIL(hr);
hr = out_mf_media_type->SetUINT32(MF_MT_AUDIO_BLOCK_ALIGNMENT, in_wfx->nBlockAlign);
DEBUG_ON_FAIL(hr);
return hr;
}
错误。
在成功回调中,$sce:itype
对象可能不是HTML代码。因此,当尝试使用response
将其信任为HTML时,它会失败。
检查$sce
对象,可能有response
包含您的HTML代码。