Manoj Majumdar
Manoj Majumdar

Reputation: 525

ngInfiniteScroll for textarea

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!!

Upvotes: 0

Views: 49

Answers (0)

Related Questions