Small fix necessary if you set initital-value to be your ng-model but…
… also update your ng-model as a result of making a selection. Essentially we must unbind the initial-value function in two scenarios - either if an initial-value is set, or if an item is selected.
Apologies for this one - spotted it as I was rolling out the new version across my site.
Why is this necessary?
Because if you take the initial-value as an object, the callOrAssign function is called as a result, which in turn updates your model (which is assigned as initial-value), which causes the display value to become the external model value.
It's hard to explain - but this is what I saw happening in my application, and adding this fix stopped the behaviour. I'll write a test for this asap, but I first wanted to ensure that other people didn't run into this.
When I tested it works as expected. And, unbind function should have no effect once it's called. So I don't see why we need this in callOrAssign. If you can create an example, that would be great.
How do assign the selected value to my ng-model, looking at html code, ng-model is set to searchStr, i want to change it to my own object to save in the database. Thank you