angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

angular cli build with AOT mode fail with @Inject(FirebaseApp) firebaseApp: firebase.app.App does not work with angular cli AOT mode

Open morninng opened this issue 9 years ago • 6 comments

I am using firebase storage in my web app and I am using following code to refer the firebase function which is not implemented in angularfire2.

@Injectable() export class LoggerService { constructor( @Inject(FirebaseApp) firebaseApp: firebase.app.App) {

However because of this code, "ng build --aot" fail with error. "ng build" succeed without any issue but I cannot use aot mode.

Version info

Angular: "@angular/common": "^2.3.1", "@angular/compiler": "^2.3.1", "@angular/core": "^2.3.1", Firebase: "firebase": "^3.6.7", AngularFire: "angularfire2": "^2.0.0-beta.7",

Other ubuntu 16.04 node v6.9.2

command to reproduce issue ng build --aot

source code @Injectable() export class LoggerService { constructor( @Inject(FirebaseApp) firebaseApp: firebase.app.App) {

Errors in terminal

ERROR in Error encountered resolving symbol values statically. Expression form not supported (position 87:49 in the original .ts file), resolving symbol LoggerService in /home/morninng/development/Angular2/mixidea_cowork/src/app/core/service/logger.service.ts

morninng avatar Jan 29 '17 09:01 morninng

Unfortunately this is an issue with the Angular compiler and we are waiting on it to get fixed.

Follow #653 and angular/angular#12631 to keep updated.

davideast avatar Jan 29 '17 12:01 davideast

I still cannot use Firebase with AOT mode by Angular4.1.0. As AOT become the default compile setting, I want to use AOT mode, but it is not possible with @Inject(FirebaseApp.

morninng avatar Apr 28 '17 11:04 morninng

@morninng Install the next tag and inject FirebaseApp

npm i angularfire2@next --save

davideast avatar Apr 28 '17 12:04 davideast

@davideast Oh thank you very much. I will try

morninng avatar Apr 29 '17 04:04 morninng

@morninng have you fixed the issue?

adsonrocha avatar May 21 '17 15:05 adsonrocha

https://gist.github.com/adsonrocha/5a70284fb49bd6b73bd66a55aa83b23f

adsonrocha avatar May 21 '17 17:05 adsonrocha