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

240
Visualizações
change the character that separates a url (Angular)

I am obtaining the url with route.queryParams.subscribe and to separate the parameters I do it with Object.keys(params) where the latter separates them when it finds the "&". My question is, can I modify that separator, where I separate it when I find the character "$" for example and not the "&"?

The short code:

this.route.queryParams.subscribe(params => {
      this.keys = Object.keys(params);

}
Example this url www.hi.com?v%2BRSC60dbdNliPmWIS8mbw%3D%3D=&uHW0Oj81Fug5ifNoPI4rGSpH5uaejSqrADBFSQhRU4fKQF3oIAXWRqtpv3TNsi3c7GDgva1P%2FozKCMFkd%2FDQEKqM1DBhmnV05psQ1n913EM5NjRNK53sEo60YxgVGky1bV%2BPB2C%2F1cG44b%2FrQPNmns7jWgQmWopQvO%2FCzWCD8o12HNQoINRzi%2FWsg9OUhoNncPl%2BU8OsJWUbKutTpW%2FiLHa4IQRvlSG59iyj6HVC2hwXwZnXVXGfDDTX3bP4Am4HQlO61CsaidcoF6mEVGSpLg%3D%3D=

when you go through the code above it looks like this, where "&" is the separator

0 : v%2BRSC60dbdNliPmWIS8mbw%3D%3D=

&

1: uHW0Oj81Fug5ifNoPI4rGSpH5uaejSqrADBFSQhRU4fKQF3oIAXWRqtpv3TNsi3c7GDgva1P%2FozKCMFkd%2FDQEKqM1DBhmnV05psQ1n913EM5NjRNK53sEo60YxgVGky1bV%2BPB2C%2F1cG44b%2FrQPNmns7jWgQmWopQvO%2FCzWCD8o12HNQoINRzi%2FWsg9OUhoNncPl%2BU8OsJWUbKutTpW%2FiLHa4IQRvlSG59iyj6HVC2hwXwZnXVXGfDDTX3bP4Am4HQlO61CsaidcoF6mEVGSpLg%3D%3D=

So, I want to know if there is a way to modify the separator character, for example instead of "&" they pass me the url with the character "$" for example and that I separate it in the same way.

This is Angular

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Just in case it is useful for you, you can use this:

in the imports

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

in your code

const id = Number(this.activatedRoute.snapshot.paramMap.get("id"));

lets suppouse your route is this one: http://localhost:4200/identification/:id

about 4 years ago · Juan Pablo Isaza Relatório

0

Why not use simple do:

string.split("any character you want")

It will return list of array of the string splitted at "any character you want". Or find the index using:

string.indexOf("any character you want")

Then splice the string accoordingly. You can even loop the string and return the index using array.forEach and splice it at that position.

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