After using 'use restrict' this directive is not working.
It's not even hitting after using function and 'use strict' its not working
(function () {
    "use strict";
    var appRoot = angular.module("app.top").directive('confirmOnExit', ['$location', 'ConfirmModal', '$timeout', function (location, ConfirmModal, $timeout) {
        return {
            link: function ($scope, element, attrs) {
                $scope.$evalAsync(function () {
                    var unbindChangeSuccess = $scope.$on('$locationChangeStart', function (event, next, current, e) {
                        $scope.DirtyForm = ($scope.componentAddForm.$dirty ? $scope.componentAddForm.$dirty : $scope.resourceForm.$dirty)
                        if ($scope.DirtyForm) {
                            event.preventDefault();
                            alert('Route Changed')                         
                        } else {
                        };
                    });
                })
            }
        };
    }]);
})
 
     
    