Giter VIP home page Giter VIP logo

Comments (9)

ronakvbhatt07 avatar ronakvbhatt07 commented on May 13, 2024 1

@dually8 hey yes i got it. I was initializing it in cunstroctur. And i got that. Thank you. Now its working fine

from angular-hmr.

alex88 avatar alex88 commented on May 13, 2024 1

Same issue here, using

@NgModule({
  imports: [
    BrowserModule,
    HttpModule,
    FormsModule,
    routing,
    NgSemanticModule,
    AngularFireModule.initializeApp(firebaseConfig, myFirebaseAuthConfig);
  ],
  declarations: [
    AppComponent,
    HomeComponent,
    AboutComponent,
    LoginComponent
  ],
  providers: [
    ApiService
  ],
  bootstrap: [AppComponent]
})

and still having that same error, there are no other calls of initializeApp in any part of the app

from angular-hmr.

ronakvbhatt07 avatar ronakvbhatt07 commented on May 13, 2024

Got anything as solution?

from angular-hmr.

dually8 avatar dually8 commented on May 13, 2024

Make sure you don't call firebase.initializeApp(config); more than once. Below is an example unit test.

import { addProviders, async, inject } from '@angular/core/testing';
import { provide } from '@angular/core';

describe('Firebase', () => {

    const config = {
        // todo: put your own stuff here
        apiKey: '',
        authDomain: '',
        databaseURL: '',
        storageBucket: '',
    };

    firebase.initializeApp(config); // call ONLY ONCE

    beforeEach(() => {
        addProviders([
            // providers here, if any
        ]);
    });

    it('should be defined', () => {
        expect(firebase.apps[0]).toBeDefined();
    });
});

from angular-hmr.

ronakvbhatt07 avatar ronakvbhatt07 commented on May 13, 2024

How can i load it only once. I am binding it in a service component. not getting how to do it

from angular-hmr.

dually8 avatar dually8 commented on May 13, 2024

Services should be singletons, so I don't know why it'd be calling it more than once. Are you putting it in a constructor or some kind of init method?

from angular-hmr.

sliker avatar sliker commented on May 13, 2024

@ronakvbhatt07 can you please give me instructions how you solve it? I'm having the same issue but don't know what to move and where to put it. Thanks!

from angular-hmr.

dually8 avatar dually8 commented on May 13, 2024

Put it in a singleton (i.e. app.ts). Here's an example: https://github.com/dually8/Ionic2-Workshop/blob/master/app/app.ts

from angular-hmr.

ronakvbhatt07 avatar ronakvbhatt07 commented on May 13, 2024

@sliker yes as @dually8 suggested put that initialize it in ngOnInit() the app.ts. This will solve your issue. And then just provide reference in the other component where you want to use. That's it.

from angular-hmr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.