Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

391
Visualizações
Property 'map' does not exist error when using Angular and Firebase

I am a beginner in angular and I try to communicate my app with firebase, using latest versions of angular and firebase

My Code:

export class ClientService {
  clientsCollection: AngularFirestoreCollection<Client>;
  clientDoc: AngularFirestoreDocument<Client>;
  clients: Observable<Client[]>
  client: Observable<Client>
  constructor(private afs: AngularFirestore) {
    this.clientsCollection = this.afs.collection<Client>('clients', ref => ref.orderBy('nom'))
  }
  getClients(): Observable<Client[]> {
    //Get id of clients
    this.clients = this.clientsCollection.snapshotChanges().map(changes => {
      return changes.map(action => {
        const data = action.payload.doc.data() as Client;
        const id = action.payload.doc.id;
        return { id, data }
      })
    })
    return this.clients;
  }
}

I get this error:

12   client: Observable<Client>
     ~~~~~~


Error: src/app/services/client.service.ts:18:61 - error TS2339: Property 'map' does not exist on type 'Observable<DocumentChangeAction<Client>[]>'.

18     this.clients = this.clientsCollection.snapshotChanges().map(changes => {
                                                               ~~~


Error: src/app/services/client.service.ts:18:65 - error TS7006: Parameter 'changes' implicitly has an 'any' type.

18     this.clients = this.clientsCollection.snapshotChanges().map(changes => {
                                                                   ~~~~~~~


Error: src/app/services/client.service.ts:19:26 - error TS7006: Parameter 'action' implicitly has an 'any' type.

19       return changes.map(action => {
                            ~~~~~~
× Failed to compile.
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda