Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
how to get a specific element in a array

I need do get a specific element in my array to make a validation and get a return of a specific navigation bar. navigation.ts

public get() {  
    this.uuid = this.usuarioService.usuarioConectado()
    let ref = this.usuarioService.getUsuario();
    ref.once('value', (snapshotChanges) =>{
      this.usuario.push(snapshotChanges.val())
      console.log("this.user.push", this.usuario)
      let usuario_logado = this.usuario[0][this.uuid]
      var role = this.usuario[0][this.uuid].role
      console.log("USER LOGADO", usuario_logado)
      console.log("ROLE USER LOGADO", role)
      this.role = role
    }).finally(() => {
      switch(this.role){
        case "USUARIO":{
          console.log("USUARIO||ON")
          return NavigationItems
        }
        case "OPERADOR":{
          console.log("OPERADOR||ON")
          return NavigationItemsParceiros
        }
        default:{
          console.log("Role não definida")
          return NavigationItemsParceiros
        }
      }
    })
  }
}

But, in this way, i don't get the return of NavigationItems/NavigationItemsParceiros, only read the console.log, how is the correct way to do that

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!