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

126
Visualizações
Is there a way to do NodeJs Express style Parameters in Angular?

I am wondering if there is a way to have a Parameter in Angular route that is similar to NodeJs Style ?

i have a route which looks like this "**http://myhost.domain.com/signin**" and i want to be able to pass an id for the signin request. I know i can do it like this "http://myhost.domain.com/signin?id=123456", but i am looking to do it more like a nodejs style where it would look like this http://myhost.domain.com/signin/123456

currently i read the params like this, but when i use the above url it cant find it since it thinks its one level deeper route.

    ngOnInit() {
            this.route.queryParams
                .subscribe(params => {
            console.log(params); 
    
          }
        );
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Yes, you can do it. First, you need to configure the route in the Router:

const routes: Routes = [
  { path: 'signin/:id', component: SignInComponent }
]

Then, you can access it in the component like this:

import { ActivatedRoute } from '@angular/router';

...

constructor(private route: ActivatedRoute) {}

...

ngOnInit() {
  const id = this.route.snapshot.params.id;
}
about 4 years ago · Juan Pablo Isaza Relatório
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