我正在使用基于Meteor v1.4和Angular2 rc-5的angular2-meteor制作应用程序.到目前为止还不错,但我需要将它与我的Firebase数据库集成,但我在下面得到了例外(我正在Chrome上运行该应用程序).似乎所
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”即可.您可以通过将以下提供程序添加到您的类中来实现.
providers: [{ provide: WindowLocation, useValue: { protocol: 'https' // Change to HTTP if you prefer. } }]
不要忘记通过编写导入WindowLocation:
import {WindowLocation} from "angularfire2";