commentpanel.js

angular.module('homepage').
directive('commentpanel', function() {
    return {
    	controller: 'commentPanelController',
        restrict: 'E',
        replace: true,
        transclude: true,
        templateUrl: 'components/content-components/login/commentpanel.html'
    }
}).
controller('commentPanelController', function ($scope, $timeout, Server) {
	$scope.isMessageVisible = false;
	$scope.message = "Comment posted successfully";
	$scope.addcomment = function () {
		Server.addcomment({comment: $scope.comment})
		.success(function (data) {
			$scope.comment = "";
			$scope.isMessageVisible = true;
			$timeout(function () {
				$scope.isMessageVisible = false;
			}, 3000);
		});
	}
});