I am using a select to show Client names. A user should be able to select an existing client, which will then update the scope property:
Controller
Initializing the "first pick".
if($scope.clients.length > 0) $scope.existingClient = $scope.clients[0];
View
<select
id='nm-existing-client-name'
class='form-control input-lg'
ng-model='existingClient'
ng-options="client.name for client in clients">
</select>
The scope property existingClient
does not change when the select menu changes. If no value is initialized (controller line above is removed), the value of existingClient
will stay undefined.
Attaching an ng-change
will fire when a value changes, but the model itself will not update to the new value.
I am using AngularJS v1.2.0-rc.3.