我一直在尝试通过Cloud Functions for Firebase从我的firebase数据库访问一些数据。 我正在对我的函数进行$ http.get()调用,但是我收到了一个错误。该函数在执行后发回一个JSON对象。 这是我的代码片段:
var url = 'https://us-central1-pickdro-f7249.cloudfunctions.net/calculateFare?clientId=clientId&distance=5';
var trustedUrl = $sce.trustAsResourceUrl(url);
console.log(trustedUrl);
$http({
method: 'JSONP',
url: trustedUrl
}).
then(function onSuccess(response) {
console.log(response);
}, function onError(status) {
console.log(status)
});
非常感谢任何帮助。