0

I am trying to bind a large string using ng-model in a textArea, but the rendering time is quite slow. So I decided to use ngInfiniteScroll to render a portion of my string, but turns out ngInfiniteScroll only works with "div" and not "td" and "textArea". So is there a way to use ngInfiniteScroll on textArea, or how can I reduce my rendering time for ng-model.

HTML code:

<td infinite-scroll="loadMore()" infinite-scroll-distance="2">
       <textarea rows="4" cols="100" ng-model="splicedSqlQuery"
          name="sqlQuery" id="sqlQuery" required
          ng-trim="true" 
          class="form-control" style="resize:vertical">
       </textarea>
</td>

JS code:

$scope.sqlQuery = "";
var arrayElementsCount = 3;
$scope.sqlQueryArr = [];
$scope.uploadFile = function (file) {
    $scope.sqlQuery = file;
    console.log("In Upload file");
    $scope.sqlQueryArr = $scope.sqlQuery.split(';');

    $scope.newArr = $scope.sqlQueryArr.splice(0, arrayElementsCount);
    $scope.splicedSqlQuery = $scope.newArr.join(";");
};

$scope.loadMore = function () {
    $scope.newArr = $scope.sqlQueryArr.splice(arrayElementsCount, arrayElementsCount + 3);
    $scope.splicedSqlQuery = $scope.newArr.join(";");
}

Thanks in advance!!

Manoj Majumdar
  • 455
  • 1
  • 4
  • 16
  • can you explain your original problem? How exactly is it slow? Even with thousands of words in your string it should be fine displaying and rendering it at every digest cycle – Aleksey Solovey Nov 13 '18 at 15:13
  • Original problem is when I am uploading a file of around 5 MB, I have to paste the whole content in a textarea through ng-model. The whole data is appended as a string which I am rendering through ng-model – Manoj Majumdar Nov 13 '18 at 18:25

0 Answers0