when declaring the variable private in the constructor, this throws me the error and does not load the view to me
import { Component } from '@angular/core';
import {incidenciasService} from '../service/incidencias.service';
import { AngularFireStorage } from '@angular/fire/storage';
@Component({
selector: 'registroSap-component',
templateUrl: './registroSap.component.html',
styleUrls: ['./registro.component.css']
})
export class registroSapComponent {
incidencia:any = {estado:"nuevo", tipo:"sap"};
constructor(private incidenciaService:incidenciasService , private afStorage: AngularFireStorage){}
Upload(event){
const file = event.target.files[0];
const randomId = Math.random().toString(36).substring(2);
const task = this.afStorage.upload('images/${randomId}', file);
this.incidencia.image = randomId;
}
guardarIncidencia(){
this.incidencia.id = Date.now();
if (this.incidencia.titulo && this.incidencia.departamento && this.incidencia.usuario && this.incidencia.descripcion) {
this.incidenciaService.guardarIncidencias(this.incidencia);
alert("¡Incidencia guardada exitosamente!");
this.incidencia = {};
}else{
alert("Complete los campos por favor.");
}
}
}
Here is the error that I get in the console
If I remove this line of code, I do not get the error but I need that!
private afStorage: AngularFireStorage