vixen-project / vixen

ViXeN is a multimedia viewer, metadata extractor and annotator.
https://vixen.readthedocs.io
Other
15 stars 8 forks source link

Fix ng-options expression by using `track by`. #2

Closed agrawalprash closed 9 years ago

agrawalprash commented 9 years ago

This is related to the issue with list of primitive variables. See jigna example here: https://github.com/enthought/jigna/blob/master/examples/list_of_primitives.py

Basically, since we create new objects every time a list is changed, angular doesn't know how to calculate what is selected. So you need to add some tracking expression against which it can compare to tell which element is selected.

Aside: According to angular docs, you shouldn't really use ng-options if the thing you're iterating over is a list of primitives. They suggest using something like this for that:

<select ng-model="vixen.camera">
<option ng-repeat="camera in vixen.available_cameras" value="{{camera}}">{{camera}}</option>
</select>
prabhuramachandran commented 9 years ago

Thanks for the pointers and the PR.