Hello,
<select class="input-xlarge" ui-select2="" ng-model="sel"
data-placeholder="Select an option"
class="ng-pristine ng-valid" style="display: none;">
<option value=""></option>
<option ng-repeat="v in obj" value="{{v.Id}}">{{v.Name}}</option>
</select>
<input type="text" name="Role" value="{{getRole()}}" readonly="readonly" />
The problem is, v is an object with {Id, Name, Role}, and select can only use a single property in the value field. If I use {{v}} it flattens the object and can't access the properties.
What I want is to set the value of input text follows the select (Ideally sel.Role, but this doesn't work as option value can't be an object).
I thought of a function (getRole()), but not sure how to watch for change of model value. Also, ng-change is not working with select2.