Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div ng-controller="commentController">
- <div class="actionBox">
- <div class="scrollbarsupreme">
- <ul style="list-style-type: none">
- <li ng-repeat="x in comments">
- <div class="commenterImage">
- <p>{{x.UserName}} Says</p>
- <a href="/Account/Profile.aspx?userId={{x.UserId}}"></a>
- </div>
- <br />
- <div class="commentText">
- <p class="commentText">{{x.Comment}}</p>
- <span class="date sub-text">on {{x.LastUpdated | date : "short"}}</span>
- </div>
- <div ng-controller="replyController">
- <button type="button" style="color: #00b7fc; background-color:black; border:none" ng-click="getRepliesByParentId()" >Show Replies</button>
- <a ng-click="replyText=!replyText" style="color: #00b7fc; padding-left: 15%">Click to reply</a>
- <div ng-show="replyText">
- <div class="text-area-container">
- <textarea id="replyTextBox" class="chat-box" style="color:black" cols="50" rows="2" ng-model="textModel"></textarea>
- </div>
- <div class="button-container btn-group btn-group-chat">
- </div>
- <div>
- <button ng-click="replyFunction();" value="{{x.Id}}" type="submit" id="getParentId" style="background-color: #000; color: #00b7fc; border: 1px solid #00b7fc">Submit Reply</button>
- </div>
- </div>
- </div>
- <hr style="width: 95%" />
- </li>
- </ul>
- </div>
- </div>
- </div>
- app.controller("commentController", function ($scope) {
- $scope.comments = [];
- $scope.replies = [];
- angular.element(document).ready(function () {
- //var parentId = $("#IdforParentId").val();
- var postId = vote.getAttribute("postid");
- WebServiceRequest("GetCommentsByPostId", "{'postId': '" + postId + "'}", commentSuccess, commentFailure)
- });
- function commentSuccess(response) {
- $scope.comments = JSON.parse(response.d);
- $scope.$apply();
- var parentId = $("#IdforParentId").val();
- //alert(response.d);
- //WebServiceRequest("GetRepliesByParentId", "{'parentId': '" + parentId + "'}", repliesSuccess, repliesFailure)
- $("#cmtComment").val('');
- }
- function commentFailure(response) {
- alert(response.d.responseText);
- }
- function repliesSuccess(response) {
- $scope.replies = JSON.parse(response.d)
- $scope.$apply();
- alert(response.d)
- }
- function repliesFailure(response) {
- alert(response.d.responseText);
- }
- $("#btnSubmit").click(function (event) {
- event.preventDefault();
- var postid = vote.getAttribute("postid");
- var commentText = $("#cmtComment").val();
- var userid = '<%=getUserId()%>';
- WebServiceRequest("SubmitComment", "{'postid': '" + postid + "', 'commentText': '" + commentText + "', 'userid': '" + userid + "'}", commentSuccess, commentFailure)
- });
- });
- app.controller("replyController", function ($scope) {
- //$scope.textModel = "Reply Text Here"
- $scope.reply = [];
- $scope.replyFunction = function () {
- event.preventDefault();
- var postid = vote.getAttribute("postid");
- var commentText = $scope.textModel; //$("replyTextBox").val();
- var parentId = $("#getParentId").val();
- var userid = '<%=getUserId()%>';
- WebServiceRequest("SubmitReply", "{'parentId': '" + parentId + "', 'postid': '" + postid + "', 'commentText': '" + commentText + "', 'userid': '" + userid + "'}", replySuccess, replyFailure)
- }
- $scope.getRepliesByParentId = function () {
- var parentId = $("#getParentId").val();
- WebServiceRequest("GetRepliesByParentId", "{'parentId': '" + parentId + "'}", repliesSuccess, repliesFailure)
- }
- function repliesSuccess(response) {
- $scope.$reply = JSON.parse(response.d)
- $scope.$apply();
- alert(response.d)
- }
- function repliesFailure(response){
- alert(response.d.responseText);
- }
- function replySuccess(response) {
- $scope.reply = JSON.parse(response.d);
- $scope.$apply();
- //alert(response.d);
- }
- function replyFailure(response) {
- alert(response.d.responseText);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement