After much struggling as a newbie to integrate AngularFire2 into an ionic2 project, I finally got it going with the help of various sources on the web. For those who are planning to use AngularFire2 into their ionic2 project, here are the steps that I use which got it working. Hope this helps some people to shorten their creation lifecycle.
Step 1: create ionic blank project
ionic start blank βv2
Step 2: install angularfire2 and firebase
npm install angularfire2 firebase βsave
Step 3: reference the Firebase 3 typings file that is included in the angularfire2 node package directly in your typings.json.
typings install file:node_modules/angularfire2/firebase3.d.ts --save --global
this saves the reference into typings.json
NOTE: requires typings v.1+
typings install
this puts the typings files in the typings/ directory.
ionic info
Your system information:
Cordova CLI: 6.2.0
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X El Capitan
Node Version: v6.0.0
Xcode version: Xcode 7.3.1 Build version 7D1014
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN angularfire2@2.0.0-beta.2 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN xxx@ No repository field.
npm WARN xxx@ No license field.
this is my ionic info
Cordova CLI: 6.2.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.10
Ionic CLI Version: 2.0.0-beta.32
Ionic App Lib Version: 2.0.0-beta.18
ios-deploy version: 1.8.5
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v5.12.0
Xcode version: Xcode 7.3.1 Build version 7D1014
The message looks like some of the required packages have not been installed. If you created your ionic 2 project using step 1, all the required packages should have been installed automatically for you by the ionic 2 cli. As mention I am new to this as well. So all I can suggest is try:
a) do an βnpm installβ in your project directory. Hopefully this will reinstall all the angular package listed in your project package.json file.
b) Redo step 2 again.
You might also want to take a look at this answer I saw on stackoverflow.
@fritters, ignore my last messageβ¦I created a test ionic 2 project with angularfire2 and firebase installed just to see if I got the same message that you posted. Yes, itβs the same message. You can safely ignore those message. The project will still run fine as I am already working on an existing project with an angularfire2 and firebase.
So bottom line just ignore the message and carry on with your newly created project.
@frittershttp://forum.ionicframework.com/users/fritters, ignore my
last messageβ¦I created a test ionic 2 project with angularfire2 and
firebase installed just to see if I got the same message that you
posted. Yes, itβs the same message. You can safely ignore those
message. The project will still run fine as I am already working on an
existing project with an angularfire2 and firebase.
So bottom line just ignore the message and carry on with your newly
created project.
The message looks like some of the required packages have not been
installed. If you created your ionic 2 project using step 1, all the
required packages should have been installed automatically for you by
the ionic 2 cli. As mention I am new to this as well. So all I can
suggest is try: a) do an β¦
I have not touch ionic or angularfire2 since I last wrote this guide in July, so I am not sure if there may have been updates on angularfire2 which may have broken the install steps.