Making transition from ionic 1 to ionic 2 and was curious about how to set up something like firebase import * as Firebase from 'somewhere/foo/';
using their typescript example.
Is bower the standard way of installing js dependencies in in ionic 2 or should I be using some other build chain/tool for adding something like Firebase?
Should I use bower install to install the firebase libraries or should point directly to a firebase cdn script source?
Should I using typings to install firebase typescript definitions?
This is the old code from the firebase tutorial https://www.firebase.com/docs/web/libraries/ionic/guide.html
index.html
<!-- AngularFire -->
<script src="https://cdn.firebase.com/libs/angularfire/1.2.0/angularfire.min.js"></script>
app.js
angular.module("starter", ["ionic", "firebase"])
which just includes cdn references to the Firebase library. How would we do this in ionic 2 and typescript
There is no bootstrap in ionic2 apps...
angularfire2
andfirebase
app.ts
home.ts
full source in git repo - aaronksaunders/ionic2-angularfire-sample
You can listen for authentication events like this
See Code Here
You need to configure both Firebase and Angularfire2 into your SystemJS configuration:
This way you will be able to AngularFire2.
The first thing then is to specify the Angularfire2 providers when bootstrapping your application:
You can then inject the
AngularFire
class: