gpt4 book ai didi

meteor - Angularfire2: "location.protocol"必须是 http 或 https(一个 Meteor 应用程序)

转载 作者:太空狗 更新时间:2023-10-29 17:37:16 24 4
gpt4 key购买 nike

我正在使用基于 Meteor v1.4Angular2 rc-5angular2-meteor 制作一个应用。到目前为止一切正常,但我需要将它与我的 Firebase 数据库集成,但出现以下异常(我在 Chrome 上运行该应用程序)。似乎我所有的 typescript 都没有问题,我没有收到任何错误,我的 Meteor 应用程序正常加载,我按照安装和设置教程进行操作,直到第 4 步结束。(但是因为我使用的是 Meteor,所以我没有使用 angular -cli 来创建项目),知道如何解决这个问题吗?谢谢

EXCEPTION: Error: This operation is not supported in the environment this application is running on. 

"location.protocol" must be http or https and web storage must be enabled.

BrowserDomAdapter.logError @ browser_adapter.js:84
BrowserDomAdapter.logGroup @ browser_adapter.js:94
ExceptionHandler.call @ exception_handler.js:65
next @ application_ref.js:348
schedulerFn @ async.js:89
SafeSubscriber.__tryOrUnsub @ Subscriber.js:225
SafeSubscriber.next @ Subscriber.js:174
Subscriber._next @ Subscriber.js:124
Subscriber.next @ Subscriber.js:88
Subject._finalNext @ Subject.js:128
Subject._next @ Subject.js:120
Subject.next @ Subject.js:77
EventEmitter.emit @ async.js:77
onError @ ng_zone.js:124
onHandleError @ ng_zone_impl.js:74
ZoneDelegate.handleError @ zone.js:368
Zone.runTask @ zone.js:297
ZoneTask.invoke @ zone.js:464

最佳答案

您只需要将 location.protocol 设置为 'http' 或 'https'。您可以通过将以下提供程序添加到您的类(class)中来做到这一点。

providers: [{
provide: WindowLocation, useValue: {
protocol: 'https' // Change to HTTP if you prefer.
}
}]

不要忘记通过以下方式导入 WindowLocation:

import {WindowLocation} from "angularfire2";

关于meteor - Angularfire2: "location.protocol"必须是 http 或 https(一个 Meteor 应用程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39295935/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com