I have a single controller with multiple views which are navigated with ui-router.
One of these views has a select input. The options for this select are loaded from array with simple objects. My model value is integer, so I want to bind to a property inside the object (as we know, Angular treats option values as strings and does strict comparison, so I need a directive to convert to/from integer, and this part seems to work fine in my code). It works fine, as long as I stay on the view with select. But the problems start when I switch between views. Although the model preserves its value, the select gets reset and shows wrong value.
How to make select survive ui-router's navigation?
Here is a Plunker to show the issue: http://embed.plnkr.co/dVQTtHpu7GYqOyN2yyVH/preview
selectvalue is being displayed wrong.idproperty. But it seems, I was not clever enough - see the accepted answer.