1var app = angular.module('commentsApp', ['pathgather.popeye']); 2 3app.controller('commentModalController', function ($scope, commentsService, Popeye, comment) { 4 $scope.comment = comment; 5 6 $scope.showSuccess = false; 7 8 $scope.cancel = function () { 9 Popeye.closeCurrentModal(); 10 } 11 12 13 $scope.addComment = function (comment) { 14 $scope.errors = []; 15 16 $scope.btnLoading = true; 17 18 comment.Guid = commentPageId; 19 20 commentsService.postComment(comment, ApiKey).then(function (result) { 21 $scope.btnLoading = false; 22 23 comment.Text = ""; 24 25 $scope.showSuccess = true; 26 27 }, function (result) { 28 $scope.btnLoading = false; 29 30 if (result.status == 400) { 31 $scope.errors = result.data; 32 } else { 33 alert("Server error:\n" + result.data.Message + "\n" + result.data.StackTrace); 34 } 35 36 }); 37 } 38}); 39 40app.controller("commentsController", function ($scope, Popeye, commentsService) { 41 $scope.loading = false; 42 $scope.btnLoading = false; 43 44 $scope.comment = {}; 45 $scope.comments = []; 46 47 $scope.errors = []; 48 49 function loadComments() { 50 51 commentsService.getComments(commentPageId, ApiKey).then(function (result) { 52 $scope.comments = result.data; 53 $scope.loading = false; 54 // console.log($scope.comments); 55 }); 56 } 57 58 loadComments(); 59 60 $scope.showModal = function () { 61 62 var modalInstance = Popeye.openModal({ 63 templateUrl: "commentmodal.html", 64 controller: 'commentModalController', 65 animation: true, 66 resolve: { 67 comment: function () { return $scope.comment; } 68 } 69 }); 70 71 modalInstance.closed.then(function () { 72 loadComments(); 73 $scope.comment.Text = ""; 74 }); 75 76 } 77 78 79}); 80 81app.factory("commentsService", function ($http) { 82 return { 83 postComment: function (comment, key) { 84 return $http.post("http://localhost:54789/comments/postcomment", comment, { headers: { 'X-Api-Auth-Token': key } }); 85 }, 86 getComments: function (page, key) { 87 return $http.get("http://localhost:54789/comments?page=" + page, {headers: { 'X-Api-Auth-Token': key } }); 88 } 89 } 90});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.