I am using Ionic2 with Typescript and can’t find a way to make firebase SDK to work. Has anybody been successful doing this?
@GeoSys Most of the new stuff in the v3 are native, so until someone write a native plugin to work with the features i think it won’t work, i may be wrong but i think thats it.
Go to project settings -> add new app --> web
Then copy paste the code into the head of the main HTML
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "mykey",
authDomain: "domain",
databaseURL: "dburl",
storageBucket: "-------",
};
firebase.initializeApp(config);
</script>
Then you should be able to address FB in your app. Take note it might give a typescript error because the new typings arent out yet.
And you need to authenticate to use storage unless you set the rules to allow unAuth
EDIT: AngularFire2 should help with Firebase integration have a look at that, though its not fully finished yet.
Thanks brickolicious, this is a great fix for the time being, I wander how long before the new typings are out.
No idea when they will be out. It gives you errors but doesnt stop the app from running. So you should be good to go.
you can use npm install typings
it helped me to run the firebase fb login atleast in browser
see a complete project here, you dont need to add that code to index.html
you can put it in a service where it belongs…
Thanks this approach is clean and tidy. Still the typings issue is a pain.