Is there any way to write comments with AngularJS so that they are not visible when viewing the source

When writing JSPs, I always use <%-- --%> instead of <!-- --> to write any comments, since it will not output to the HTML. I have begun using AngularJS, and I'm wondering if there's any similar kind of comment construct that I could use. It's not absolutely necessary to not have the comments visible in the HTML source, but I much rather them not being there.

With the limited knowledge I have of AngularJS, I'm not sure how they could prevent it from being in the source, but I just want to ask in case there is a way. Perhaps there's also a best practice for comments in AngularJS? Any input would be appreciated.

AngularJS is a library for dynamic features in HTML/JS/CSS pages. It's not a template language such as JavaServer Pages. As such, it doesn't have a special syntax for comments. You can still use HTML style comments of course.

You should use a pre-deployment processing tool such as grunt uglify. It will allow you to strip out comments and do more useful deployment pre-processing such as minifying code.

grunt uglify

Use directives:

myApp.directive('comment', ['$rootScope', function($rootScope) {

return {
    restrict: 'AEC',
    link: function($scope, element, attrs){
        $(element).remove();
    }
};

}]);

example: Remove me