|
1 | 1 | 'use strict'; |
2 | 2 |
|
3 | 3 | angular.module('codeSearchApp') |
| 4 | + // .filter('snippitHighlight', function($sce) { |
| 5 | + // return function(content, snippit) { |
| 6 | + // // var text = content.replace(snippit, '<span>"hello"</span>') |
| 7 | + // var snippitStartIdx = content.indexOf(snippit); |
| 8 | + // var snippitEndIdx = snippitStartIdx + snippit.length; |
| 9 | + |
| 10 | + // var snippitSubStr = content.substring(snippitStartIdx, snippitEndIdx); |
| 11 | + // var preSnippitBody = content.substring(0, snippitStartIdx); |
| 12 | + // var postSnippitBody = content.substring(snippitEndIdx); |
| 13 | + |
| 14 | + // return $sce.trustAsHtml('<strong>HELLLLO</strong>'); |
| 15 | + // }; |
| 16 | + // }) |
4 | 17 | .controller('ModalCtrl', function ($scope, $http, $modalInstance, data) { |
5 | 18 |
|
6 | 19 | $scope.ok = function () { |
7 | | - $modalInstance.dismiss('cancel'); |
| 20 | + $modalInstance.dismiss('require'); |
8 | 21 | }; |
9 | 22 |
|
10 | 23 | $scope.snippitObj = data.snippitObj; |
11 | 24 |
|
12 | | - $scope.snippit = data.snippitObj.snippit; |
| 25 | + |
| 26 | + var content = data.snippitObj.docContent; |
| 27 | + var snippit = data.snippitObj.snippit; |
| 28 | + |
| 29 | + var snippitStartIdx = content.indexOf(snippit); |
| 30 | + var snippitEndIdx = snippitStartIdx + snippit.length; |
| 31 | + |
| 32 | + $scope.snippitSubStr = content.substring(snippitStartIdx, snippitEndIdx); |
| 33 | + $scope.preSnippitBody = content.substring(0, snippitStartIdx); |
| 34 | + $scope.postSnippitBody = content.substring(snippitEndIdx); |
13 | 35 |
|
14 | 36 | }); |
| 37 | + |
0 commit comments