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

274
Visualizações
How to hide some params in URL with AngularJS UI Router?

I wanted to define a route that received one mandatory param and another optional param that would be hidden in the URL. It would be something like:

http://www.myapp.com/viewingPodcast/4

and the hidden param still available but not shown in the URL.

I am using ng-href + $state.href to get the url. I also have looked at this answer and it's comments but I still couldn't get it to work with my version.

This is my state config


.state("viewingPodcast", {
          ...
          url: "/podcast/:id",
          controller: "podcastCtrl",
          templateUrl: ...,
          params: { zineId: null },
          data: {
           ...
          },
          resolve: {
            ...
          },
        })

And the $state.href:

...
$state.href("viewingPodcast", { id: content.id, zineId: content.zineId });
...

Both values (id and zineId) are not nulled when debugging the $state.href line. I tried, like mentioned in the comments of the answer above:

$state.href("viewingPodcast", { id: content.id, zineId: { zineId: content.zineId } });

but when entering the controller and checking the params (with $state.params.zineId) the value is null.

I don't know if I'm doing something wrong and I still can't comment to ask on the other answer so I'm stuck creating a new question.

Thanks in advance

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