aL3xa
aL3xa

Reputation: 36080

Speed up loading dynamically generated form/template in AngularJS

I'm generating a form from JSON data that I load via $http.get(), hence use bunch of custom/3rd party directives (ui-select, Bootstrap UI, ...) to get the desired end result. Just to make things more interesting, forms are nested, and with ng-repeat, things still feel pretty sloppy, especially on mobile. Form is quite lengthy and I've split it in several sections, so putting ng-if and displaying one section at a time, as well as using bindonce does improve performance a bit, but not to the extent that I find suitable from UX POV.

The catch 22 is that underlying JSON data is unlikely to change, so ideally I'd like to go with the sloppy version in development, but in production I'd like to build/compile the form, and make it load faster.

I know that 3rd party libraries (namely ui-select) introduce bottleneck, but apart from using $templateCache with $compile in app.run() section, or rendering the form with templating engine such as ejs, what other tweaks should I take into consideration in order to improve performance?

Upvotes: 0

Views: 138

Answers (1)

NiranjanK
NiranjanK

Reputation: 437

U can also go for caching of data using IndexedDb or Local Storage to cache the JSON Data which can result to load form more faster.

Upvotes: 1

Related Questions