improved the directive by removing the $watch and using scope.$on('$destroy') instead.