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

Created on 29 Jan 2017  路  6Comments  路  Source: angular/angularfire

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

All 6 comments

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.

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 Install the next tag and inject FirebaseApp

npm i angularfire2@next --save

@davideast
Oh thank you very much. I will try

@morninng have you fixed the issue?

Was this page helpful?
0 / 5 - 0 ratings