-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Angularfire2 seems to not load in ionic2 #688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ix-xerri Seems like this is working as expected. I wrote quick code (not following best practices, but this should work for the purposes of this issue) and have pasted below for your reference. I've attached the service file as well as two pages, which shows the navigation. This should get you going. Let me know, if this doesn't works for you. I am on Windows 10 with following versions.
Snippet from my package.json
home.ts
success-page.ts
auth-service.ts
|
What do you mean 'as expected'? Please have a look here. There are other users with the same issue. As explained by me |
@ix-xerri When you posted your issue, I assumed, you're not able to run your Ionic app with AngularFire2 (specifically, you're not able to authenticate using angular fire2) and hence I pasted the snippet code above, as I am able to get it running on my machine locally. I did mention the various modules, along with their version numbers. Now with the above link, you're referring to an issue which seems to be more of Ionic and not angularFire2. For me the AngularFireModule.initializeApp(firebaseConfig) line does load. My repo is here, incase you want to have a look Please correct me, if I am missing something. |
My issue is that I'm not able to load the site correct. But because I initialise AngularFire, the build does not complete. Here is a snippet of my package.json "dependencies": { |
Looks Ok. Do you want to share your repo, especially app.module.ts. |
Here is my app.module.ts import { NgModule } from '@angular/core'; import { AngularFireModule } from 'angularfire2'; console.log(AngularFireModule); @NgModule({ |
You app.module.ts looks good. Won't be able to decipher more from it. |
Can't share it. Sorry but there are other users with the same issue. |
I just tried using the firebase library alone and it works. Can write to a database no problem and there are no errors. |
Great to hear, you have an option. See if you want to have a second look at my repo. |
@ix-xerri Did you use firebase library alone for the whole app or for initialising the app in app.module.ts to get it to work. I am still having this problem |
1 similar comment
@ix-xerri Did you use firebase library alone for the whole app or for initialising the app in app.module.ts to get it to work. I am still having this problem |
@mukesh51 everything is the same with the app in ur repo yet the error still exist |
didn't try to user angularfire after initialising. So far not angularfire is being used but will try it today! |
Ok. Thanks. I will be expecting your response |
Same error and the site is not building. I've been told that the app is not loading angularfire when dealing with the same issue but it is is node_modules and using `import firebase from 'firebase'; import { AngularFire, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2'; inside /pages |
What is that suppose to do? I still get |
when you use this statement
you're explicitly importing NavController object from 'ionic-angular'. Now, if you want to import another object from the same module, you try to add it in the same import statement by specifying the object, separating it with a comma. What if you want to import everything in one go, that is where you use *. Hope that helps. |
I tried it and got the same error |
Sorry @ix-xerri . Without looking at the repo, I may not be able to add more. Hopefully someone else.
I am not sure if that is a problem, but you can give it a try. |
I updated zone.js to 0.6.26 but no luck |
You can try to use Firebase 3.3.0. Thats the version angularfire2 uses. Maybe there is a conflict when you try to use two different versions in the same class. |
it works! need to go into detail and use angular fire but the build finishes and the site loads no problem. |
Hurray!!!. It works. Thanks a lot @ix-xerri, @mukesh54 and @chris1308 |
Glad you were able to resolve this. In the future, please follow the issue template and submit a working repro of the issue from the start, and it won't require so much dev time to get to the solution. |
@ix-xerri Sorry if I missed it, but what did you do to get this to work? you added Firebase to your package.json in addition to the angularFire package? |
You need Firebase 3.3.0 and the latest angularfire |
@ix-xerri Thanks got it. I had removed node_modules multiple times. NPM clear cache and correct fresh package.json must have done the trick finally... |
In my package.json, i do have firebase version "firebase": "^3.6.1", and it works fine for me. I've my repo here. I've got |
@mukesh51 interesting. I wonder if you were to upgrade your ionic-cli to 2.1.12 if you would have the same error we were experiencing. I will try the ^3.6.1 of firebase repo and see if I can still reproduce the issue. |
when I am retrieving data from firebase it show |
2.0.0-beta.6-preview
Angular:
2.2.1
Firebase:
3.6.1
AngularFire:
2.0.0-beta.6-preview
Other (e.g. Ionic/Cordova, Node, browser, operating system):
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.44
ios-deploy version: 1.9.0
ios-sim version: 5.0.11
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 8.1 Build version 8B62
How to reproduce these conditions
I'm trying to run angularfire after having the plain firebase library working (used only for login so far). I'm using ionic and ionic serve is not working. I'm getting this during ionic serve:
[19:04:51] ionic-app-scripts 0.0.44
[19:04:51] watch started ...
[19:04:51] build dev started ...
[19:04:51] clean started ...
[19:04:51] clean finished in 4 ms
[19:04:51] copy started ...
[19:04:51] transpile started ...
[19:04:55] build dev failed: Cannot read property 'indexOf' of undefined
[19:04:55] copy finished in 3.41 s
[19:04:55] watch ready in 3.43 s
[19:04:55] dev server running: http://localhost:8100/
In the www/build folder the html and the js file are not there so the build is not completing.
Debug output
** Errors in the JavaScript console **
http://localhost:8100/build/main.css Failed to load resource: the server responded with a status of 404 (Not Found)
(2) http://localhost:8100/build/main.js Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8100/build/main.css Failed to load resource: the server responded with a status of 404 (Not Found)
Expected behavior
Site loads
Actual behavior
Site does not load because of missing js and html files when angular fire is just imported
The text was updated successfully, but these errors were encountered: