Angularfire2: "location.protocol" must be http or https (Meteor app)

I am angular2-meteor application with angular2-meteor based on Meteor v1.4 and Angular2 rc-5 . everything is fine so far, but I need to integrate it with my Firebase database, but I get an exception below (I run the application in Chrome). it seems that all my typescript is ok and I have no errors, my Meteor application loads fine, I followed the installation and configuration instructions until the end of step 4. (However, since I use Meteor, I do not use angular-cli to create project), any idea how to fix this? thanks

 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 
+5
source share
1 answer

You just need to set location.protocol to 'http' or 'https' . You can do this by adding the following provider to your class.

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

Remember to import WindowLocation by writing:

 import {WindowLocation} from "angularfire2"; 
+3
source

All Articles