0

I tried checking out a few answers but most of them were related to either list or table and one answer I found was related to ace.js which I could not understand completely so posting the same.

I have a project in Node.js which will create the XML content dynamically based on the user input and the final output of the created XML can be very large as they can create 1000's of XML. After the creation, the XML content will be returned to AngularJS where I am populating the Textarea with the returned content.

The XML content is created pretty quickly and returned to AngularJS but I observe that after getting the response the loading of the XML content to textarea is taking a lot of time. I wanted to know is there any method using which I can fasten the process.

My HTML file with the text area field index.html:

<textarea class="form-control" id="xmldata" ng-model="xmldata" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>

My AngularJS HTTP request which will return the XML content:

$http({
    url: "/XMLCreatir",
    method: "POST",
    data: data
}).success(function(response) {
    console.log("RECEIEVED XML");
    $scope.xmldata  =   response;
});

I can observe that the RECEIVED XML is displayed pretty quickly but the Textarea will not load the content and also most of the time browser crashes.

Can someone please help me with this issue.

BATMAN_2008
  • 2,788
  • 3
  • 31
  • 98
  • Does this answer your question? [Large text in TextArea freezes computer](https://stackoverflow.com/questions/1600398/large-text-in-textarea-freezes-computer) – OfirD Sep 09 '20 at 10:39
  • @OfirD Thanks for the response. No actually that does not answer completely. I am using the `Chrome` browser and as you can see from my code, some of the things mentioned in that answer I have incorporated already in my application such as `autocomplete`, ``spellcheck` etc. I am guessing there should be some JS library or some workaround to show this data. Thanks and looking forward to your suggestions. – BATMAN_2008 Sep 10 '20 at 09:28
  • There's no way around it. Large text means long rendering. See also [JavaScript update textarea freezes Chrome, but not Firefox](https://stackoverflow.com/questions/48675786/javascript-update-textarea-freezes-chrome-but-not-firefox). You can limit the length, though, see this [one](https://stackoverflow.com/questions/5533053/textarea-character-limit). – OfirD Sep 10 '20 at 09:56
  • Ok but if you check this answer they are trying to use some JS library to make it faster https://stackoverflow.com/questions/43689920/dynamically-displaying-large-amounts-of-text-by-partially-displaying-data-in-tex So I guess there are some libraries or some other approach which can make it a bit faster. – BATMAN_2008 Sep 10 '20 at 12:28
  • *Making it a bit faster* - make sure you understand what's that *"it"*. If it is the user experience, then absolutely, if lazy loading (which is what that answer attempts) fits you, go ahead and implement it as suggested, it's definitely another mitigation you can use to allow good user experience. However, if you're expecting to keep having a large text inside the textarea, then expect long rendering (and crashing). – OfirD Sep 10 '20 at 12:48

0 Answers0