I am having a problem binding data retrieved from the server to a drop down list. The main issue I think is the fact that the comparison is done on differing object types.
It is not exactly clear what the problem is, but you can save yourself some work by binding the to the currently selected currency object (so you don't have to look it up later).
select
+ ngOptions
allow you to bind to one value while displaying another, with the following syntax:
In the above example, $scope.selectedCurrency
will be bound to the whole currency
object, but currency.shortDescription
will be displayed in the dropdown.
See, also, this short demo.
UPDATE:
In case you don't need to bind to the whole currency object, but just bind updatedObject
's baseCurrencyCode
property to the abbreviation of the selected (in dropdown) currency, you can do it like this:
// In the CONTROLLER
$scope.currencies = [...];
$scope.updatedObject = {
...
baseCurrencyCode:
};
See, also, that short demo.