Guest User

Untitled

a guest
Apr 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <div ng-app="app">
  2. <div ng-controller="Controller">
  3. <select data-ng-model="model" data-ng-options="option.id as option.text for option in options"></select>
  4. </div>
  5. </div>
  6.  
  7. var app = angular.module('app', []);
  8.  
  9. app.controller('Controller', function ($scope) {
  10. $scope.model = '2'; // This works as an integer (2) but not as a string ('2')
  11. $scope.options = [
  12. {id: 1, text: '11111'},
  13. {id: 2, text: '22222'}, // I want this option to be selected
  14. {id: 3, text: '33333'}
  15. ];
  16. });
Add Comment
Please, Sign In to add comment