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

210
Visualizações
Angular: Refresh DOM after manupulating code using browser console javascript

A website is written in Angular.js and they have filtering options which have all the categories checked by default with No "Clear All" filter options. Filter Options

Like this website image (This is Amazon), they have a clear button, but the website I want to work on (can't disclose the name) does not have the clear all filter button ( website is made in Angular).

So, I managed to use Javascript to clear all the checkboxes and were unchecked using this Code snippet entered in the Browser console.

var inputs = document.getElementsByTagName('input');

for (var i=0; i<inputs.length; i++)  {
  if (inputs[i].type == 'checkbox')   {
    inputs[i].checked = false;
  }
}

And using this snippet in the Chrome Browser console, I was able to uncheck all the checkboxes but it did not make the changes to the dom and products did not get filtered. They remained the same as if all the check box were still checked. enter image description here

Is there any way to refresh the DOM, after writing the js snippet in console log so that the DOM can check the changes and update the page?

Thanks

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

0

You might need to trigger a new digest cycle so that AngularJS picks up the changes. You can do that by getting the scope of an element and triggering it's $apply function:

angular.element('input').scope().$apply()
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