Pasvaz/bindonce

Need clearer understanding of when I can use bindonce

jerrykur opened this issue · 2 comments

Hi,

I am suffering through a performance issue with IE8 and a select list. When I load 500 or so entries it takes 4-5 seconds for the list to appear the UI to unfreeze. (Takes less that second with Chrome.) I assume this if because angular is building the s. I use ng-option instead of ng-repeat but can change if necessary. Is this a scenario where bindonce can improve performance? If so, can I reload the data? I have a series of control buttons next to the select list and when the user presses a button we query the DB again using different parameters and reload the list. Finally, if I use bindonce can I use ng-model to detect which items the user has selected? Thanks, Jerry

If you can use ng-options on the , definitely do so, as opposed to ng-repeat on . If you had to use ng-repeat on for some special case, then yes, you would use bo-text instead of {{}} for filling out the options. If you're already using ng-option, then I don't think bindonce can offer any help here. Angular only uses two watchers on , regardless of your option size.

For Angular's to work, I think the ng-model directive has to be present, so that is certainly something you can use for change detection.

@dbkingsb, please review your answer as rendered on GitHub.com. It seems to be missing some words.