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

123
Visualizações
Reapply AngularJS after changing HTML

Inside a larger legacy app I have a view that uses AngularJS. In this view, I use a directive to display a Bootstrap modal (its content is created on the backend, then appended to the DOM).

No AngularJS methods seem to be working inside the modal. I understand it's because the modal content is appended to the DOM after AngularJS has compiled.

I'm looking for a way to allow the use AngularJS braces and methods inside the modal template. I've tried looking into $compile, $apply, and $digest, but so far I haven't been able to get it to work.

Relevant part of the code:

    myApp.directive('formModal', ['$http', function($http) {
        return {
            restrict: 'E',
            scope: true,
            replace: true,
            template: '...',
            link: function postLink(scope){
                // ...
                $http({url: url}).then(function (response) {
                    if (response.data.status) {
                        modal.show({
                            title: 'Modal title',
                                content: response.data.form_html,
                                onShow: function ($modal) {
                                    // ...
                                }
                            });
                        };
                    })
                };
            }
        };
    }]);

And part of the template where the modal is opened:

<form-modal class="btn-success" id="btn-form">
</form-modal>
over 4 years ago · Santiago Trujillo
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