我试图通过HTTPS POST方法在离子中请求服务器。但有些原因,它每次都失败了。我不知道为什么会这样吗?有没有正确的方法?
$http({
url: "https://beta.test.com/auth/authenticate/",
method: "POST",
data: {userName: "xxx", password: "xxx", ipAddress: "xxx", remeberMe: true},
headers: {'Content-Type': 'application/json'}
}).success(function (res) {
$scope.persons = res; // assign $scope.persons here as promise is resolved here
}).error(function (res) {
$scope.status = status;
});
答案 0 :(得分:2)
看起来你的成功函数中的代码应该是$ scope.persons = res.data。
答案 1 :(得分:0)
应该是这样的
from sqlalchemy import event
from sqlalchemy.engine import Engine
@event.listens_for(Engine, "connect")
def set_sqlite_pragma(dbapi_connection, connection_record):
cursor = dbapi_connection.cursor()
cursor.execute("PRAGMA foreign_keys=ON")
cursor.close()
但请在控制台中检查您是否会得到正确的回复