B
B
bullyy2016-03-04 14:40:01
Angular
bullyy, 2016-03-04 14:40:01

How to improve the performance of ng-options?

<select class="form-control inputsm" ng-model="c.value" name="select_{{c.term}}" ng-options="item.name for item in c.values track by item.id" ng-required="c.required"></select>

There may be cases when there are 200+ objects in the values ​​array and there are 9 such selects on the page. In IE9-11, the page takes a very long time to load, is it possible to optimize this somehow.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-03-04
@bullyy

In IE9-11, the page takes a very long time to load, is it possible to optimize this somehow.

What does this have to do with ng-options? If we are talking about performance, and our list does not change, then one-time bindings can be used. If it changes, then just change not the array itself, but create a new one, then track by and so the DOM will be reused.
In general, your problem is not that Angular and ngOptions, but that you have 200 * 9 DOM elements stupidly displayed on the list in IE9-11. Of course, this will slow things down a bit. The alternative is to ditch select and use some autocomplete stuff or virtual scroll selects.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question