A demo app integrating Firebase 3 into Ionic 2
Note that this project has been entirely replaced with a new update that matches Ionic 2's RC2 release.
This project serves as a demo for how I integrated Firebase 3 into an Ionic 2 project. It includes basic database syncing, as well as Firebase user authentication. The goal was to create a demo app that could accompany a blog post I wrote.
In order to set up this project, I had to previously create a Firebase app, following the steps outlined in their guide. Those steps are beyond the scope of the tutorial I wrote, and this demo begins at the point when:
You can find information on all of these topics in the Web guide in the Firebase docs.
You're welcome to continue using my Firebase instance in running this demo. Please don't overuse it, as I'm on the free tier and therefore only have a certain amount of requests and connections afforded to me every month. If you'd like to replace my Firebase account details with your own, instructions on how to do that are listed below.
When you clone this repo, it will come with nothing but the app files. You'll need to run through the installation process for building an Ionic project, which is normally done for you in ionic start
.
Here's the output from my ionic info
that allows me to run simulators and build appropriately for iOS:
Cordova CLI: 6.1.1
Ionic Framework Version: 2.0.0-rc.2
Ionic CLI Version: 2.1.8
Ionic App Lib Version: 2.1.4
Ionic App Scripts Version: 0.0.46
ios-deploy version: 1.8.6
ios-sim version: 4.1.1
OS: OS X El Capitan
Node Version: v6.2.1
Xcode version: Xcode 7.3.1 Build version 7D1014
Keep in mind that - for whatever reason - this doesn't display any information about my Android stuff. Which, I mean, I dunno why. Anyway, here they are:
$ npm install
www/
DirectoryYes, that sounds weird, but from my experience, as well as reading through this issues post it looks like you'll need to create a www/
directory in order for some Cordova-based commands to realize you're in a Cordova-based project.
$ mkdir www
The folks at Ionic were nice enough to add a command that builds your project based on the plugin and platform information stored in the package.json
:
$ ionic state restore
If you'd like, add Android.
$ ionic platform add android
Provided you've followed the instructions above, and have an internet connection, you should be able to run the app, and see the stuffs. It's all coming from a demo app that I have set up on my Firebase dashboard, which has two seeded records, and one dummy user.
# for some reason, I had to run this twice on the first go
# maybe once to build, and once to serve?
$ ionic run ios
$ ionic run android
{
static: string,
private: string
}
{
"rules": {
".read": "true",
".write": "auth != null",
"private": {
".read": "auth != null"
}
}
}
src/providers/data/data.service.ts
file of this repo, and replace the database details listed on lines 17-20 with the details from your database.Cake and grief counseling will be available at the conclusion of the test.