Skip to content

Instantly share code, notes, and snippets.

@KhanMaytok
Created August 18, 2015 14:59
Show Gist options
  • Save KhanMaytok/f0825cedc5782af6c8c9 to your computer and use it in GitHub Desktop.
Save KhanMaytok/f0825cedc5782af6c8c9 to your computer and use it in GitHub Desktop.
Populate a select with angular
<select ng-model="selectedTestAccount" ng-options="item.Id as item.Name for item in testAccounts">
<option value="">Select Account</option>
</select>
angular.module('test', []).controller('DemoCtrl', function ($scope, $http) {
$scope.selectedTestAccount = null;
$scope.testAccounts = [];
$http({
method: 'GET',
url: '/Admin/GetTestAccounts',
data: { applicationId: 3 }
}).success(function (result) {
$scope.testAccounts = result;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment