Click here to Skip to main content
16,020,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
app.config.ts :
TypeScript
<pre>const firebaseConfig = {
  apiKey: "",
  authDomain: "",
  databaseURL: "",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
  measurementId: ""
};




export const appConfig: ApplicationConfig = {
  providers: [
    provideRouter(routeConfig, withComponentInputBinding()),
    provideFirebaseApp(() => initializeApp(firebaseConfig)),
    provideAuth(() => getAuth()),
    provideFirestore(() => getFirestore()),
  ],
};
DataSharingService.ts :

TypeScript
<pre>@Injectable()
export class DataSharingService {
    public isUserLoggedIn: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
}


What I have tried:

I already posted 2 problems here ( sign up and login are not working after form submission ) , so I said maybe cuz firebase isn't correctly linked to my angular project ( btw those fields in app.config.ts are not empty , just for security reasons )
Posted
Updated 6-Jul-24 13:20pm
v3

1 solution

The shape of the firebase configuration looks correct. Make sure that the values you have in there match the configuration of the Firebase you are connecting to. You say that you are having problems in parts of your application; you are going to have to debug the code to see what those potential problems are. BTW, the common way to hook up to Firestore normally looks like this in your app imports:
TypeScript
AngularFireModule.initializeApp(firebaseConfig),
AngularFirestoreModule
At that point, you are just injecting AngularFirestore into services and working with them directly there.
 
Share this answer
 
Comments
Mohamed Seif Ben Salah 7-Jul-24 20:39pm    
Pete O'Hanlon , can u explain this more ( if u can give me code ) : BTW, the common way to hook up to Firestore normally looks like this in your app imports:

AngularFireModule.initializeApp(firebaseConfig),
AngularFirestoreModule
Pete O'Hanlon 8-Jul-24 6:12am    
I found an example for you here. https://developers.google.com/codelabs/building-a-web-app-with-angular-and-firebase#10
Mohamed Seif Ben Salah 8-Jul-24 19:34pm    
i tried to do it but it was very complexed because of @ngmodule , @component , standalone , but thank u bro

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900