我正在尝试使用以下Git链接上共享的项目: https://github.com/ionepaul/angular-plugin-architecture。 当我尝试在插件组件中添加任何依赖项时,总是会出现StaticInjectorError错误。有人可以帮我找到问题的根本原因。
我尝试使用Angular的DatePipe,但遇到相同的错误。
Response sendHTTPS(Request& request) {
#ifdef _WIN32
WSADATA wsaData;
WORD DllVersion = MAKEWORD(2, 2);
if (WSAStartup(DllVersion, &wsaData)) {
return Response();
}
#endif
std::string req = request.to_string();
addrinfo* pAddrInfo;
getaddrinfo(request.uri.host.c_str(), "443", 0, &pAddrInfo);
SOCKET connection = socket(
pAddrInfo->ai_family,
pAddrInfo->ai_socktype,
pAddrInfo->ai_protocol
);
if (!connection)
return Response();
int error = connect(connection, pAddrInfo->ai_addr, pAddrInfo->ai_addrlen);
if (error)
return Response();
SSL_library_init();
SSLeay_add_ssl_algorithms();
SSL_load_error_strings();
SSL_CTX* ctx = SSL_CTX_new(TLS_method());
SSL *ssl = SSL_new(ctx);
if (!ssl)
return Response();
SSL_set_connect_state(ssl);
SSL_set_tlsext_host_name(ssl, request.uri.host.c_str());
int sock = SSL_get_fd(ssl);
SSL_set_fd(ssl, connection);
error = SSL_connect(ssl);
if (error <= 0) {
/*int err;
std::string what;
while ((err = ERR_get_error())) {
char *str = ERR_error_string(err, 0);
if (!str)
break;
what.append(str);
what.append("\n");
}
throw std::exception(what.c_str());*/
}
int len = SSL_write(ssl, req.c_str(), req.size());
if (len <= 0)
return Response();
std::string result = "";
char buffer[16384] = { 0 };//16 kib
int bytes_recv = 0;
do {
bytes_recv = SSL_read(ssl, buffer, sizeof(buffer));
if (bytes_recv > 0)
result.append(buffer, bytes_recv);
} while (bytes_recv > 0);
closesocket(connection);
SSL_shutdown(ssl);
SSL_free(ssl);
SSL_CTX_free(ctx);
return Response(result);
}