我正在尝试使用 API URL。我正在使用以下代码调用 API。
import {HttpClient, HttpClientModule, HttpParams} from "@angular/common/http";
@Injectable()
export class PropertyPrefService {
constructor(private http: HttpClient,
private configurationService:Configuration) {}
public searchProjects(propFilter:string):any{
let temp:any;
const options = propFilter ?
{
params: new HttpParams().set('query', propFilter)
} : {};
return this.http.get<any>(this.configurationService.propertySystemApiUrl, options)
.subscribe((results:any) => {
console.log(results);
});
}
在 Angular 代码中,我没有得到任何响应并且出现错误:
(未知 url)的 Http 失败响应:0 未知错误”。
但是,当我在 Chrome 上打开开发人员工具时发出请求时,我会看到从服务器收到响应。
该 URL 是“https://...” URL 而不是“http://...”。