0
  $scope.status = function()
  {
    $http({url:'url', method:"GET", withCredentials: false, headers:{
         'Authorization': 'Token ' + token,
      }
    })
    .success(function(result) {
        console.log("Success", result);
        $scope.resultGet = result;
        alert("success");
    })
    .error(function(error, status, header, config) {
        $scope.error = { message: error, status: status};
        console.log($scope.error, config);
    });
}

我已经尝试了上述方法来设置 withCredentials:false。但不恢复任何更改。它总是需要 withCredentials:true。

因此我得到错误。”'XMLHttpRequest 无法加载“API url”。对预检请求的响应未通过访问控制检查:当凭据时,不能在“Access-Control-Allow-Origin”标头中使用通配符“*”标志为真。因此不允许访问源“ http://localhost:3000 ”。”

我也尝试过在 expressjs.Using cors() 中设置 withCredentials:false。但没有变化。

4

1 回答 1

0

因为布尔值在 URL 中被转换为文本,所以需要将其作为文本进行操作或尝试解析 0,1 而不是 true、false。

从概念上讲,任何非空白或非 0 的都是真的。

于 2016-04-22T07:02:52.257 回答