Custom Javascript code Refresh button

Here’s my refresh button, based on Button to go back to previous dashboard

habpanel-refreshbutton.js:

angular.module("refreshButton", [])
.directive("refreshButton", ["$window", function ($window) {
    return {
        restrict: "A",
        link: function (scope, elem, attrs) {
            elem.bind("click", function () {
                $window.history.go(0);
            });
        }
    };
}]);

The custom widget:

<div class="btnwidget" oc-lazy-load="['/static/habpanel-refreshbutton.js']">
  <div class="flex">
    <button refresh-button class="btn2" style="outline: none; background-color: transparent; border: 0px; flex: 1 1 auto">
            <div class="" style="font-size: 4.5vw">Reload Panel</div>
  </button>
</div>