Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!