OK I managed I think to get what I want by altering the data array and 
calling it like:

<select id="country_id" type="text" class="form-control" 
ng-model="formData.country_id" ng-value="formData.country_id" 
ng-options="country.id as country.name for country in formData.countries"/>

But when I submit the form its not sending the formData.country_id its 
sending all the formData.countries array.

Any ideas where I went wrong?

On Thursday, September 10, 2015 at 4:50:31 PM UTC-2:30, Dave Abbott wrote:
>
> I need to populate a <select> with a list of countries.
>
> This is as close as I get.
>
> HTML:
> <select id="country_id" type="text" class="form-control" 
> ng-model="formData.countries" ng-options="k as v for (k,v) in  
> formData.countries track by v"/></select> 
>
> So my select initially has all the countries pulled from the database and 
> returned in $scope.formData;
>
> so the raw data is a key value array of data like:
>
> {
>
> ..... ohter data
>
> countries:
> ["Afghanistan",
> "Albania",................
> "Zimbabwe"]
> }
>
> When I select a country it then changes to the key so if i select USA the 
> select now displays 142
>
> Tried every way I can think of and no go.
>
> Any help would be great.
>
> Thanks,
>
> Dave
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to