Created
          August 18, 2015 14:59 
        
      - 
      
- 
        Save KhanMaytok/f0825cedc5782af6c8c9 to your computer and use it in GitHub Desktop. 
    Populate a select with angular
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <select ng-model="selectedTestAccount" ng-options="item.Id as item.Name for item in testAccounts"> | |
| <option value="">Select Account</option> | |
| </select> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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