Refresh HTML panel on auto-refresh

Within my dashboard I have a HTML panel, which I want to auto refresh every time the dashboard refreshes. In release 5.3.4, I achieved this with the following code:

   <div id="myTextPanel" class="ng-scope">
     <script type="text/javascript">
       function refreshMyPanel() {
         // SOME FUNCTION THAT GENERATES TableHolder
       }
       $(document).ready(function() {
         refreshMyPanel(); // For the initial load of data
         // Refetch data every time the "refresh" event is broadcast
         angular.element('#myTextPanel').injector().get('$rootScope').$on('refresh', function() {refreshMyPanel();});
        });
       </script>
       <p id="TableHolder"></p>
    </div>

However, since release 5.4 this is no longer working. What has happened in the new release that this is no longer working or is there an alternative solution?

Any updates or solutions for this yet? I’m facing the same problem!