Angular: Select 2 Json Sources
http://angularjs.org/
by TheFiddler
HTML
<script src="http://code.angularjs.org/angular-1.0.0rc6.min.js"></script>
<div ng-controller="Main" ng-app>
<div>selection id = {{job.countryid}}</div>
<div>
<p>Update Model and Two Way Bind from Two Data Sources</p>
<select ng-model="job.countryid" ng-options="i.countryid as i.name for i in countries">
<option value=""></option>
</select>
</div>
CSS
div {
margin-bottom: 2em;
}
JavaScript
function Main($scope) {
$scope.job = {"id":22222,"entity_id":22,"user_id":939393,"title":"Director of Ticket Sales","company":"Stow Riversharks","city":"Stow","state":"OH","postal_code":"44224","country":"United States","countryid":"0"};
/*
$scope.job = [{"id":22222,"entity_id":22,"user_id":939393,"title":"Director of Ticket Sales","company":"Stow Riversharks","city":"Stow","state":"OH","postal_code":"44224","country":"United States","countryid":0}];
*/
$scope.countries = [{
'countryid': '0',
'name': 'Name 1'},
{
'countryid': '2',
'name': 'Name 2'},
{
'countryid': '3',
'name': 'Name 3'}];
}