Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div ng-app="app">
- <div ng-controller="Controller">
- <select data-ng-model="model" data-ng-options="option.id as option.text for option in options"></select>
- </div>
- </div>
- var app = angular.module('app', []);
- app.controller('Controller', function ($scope) {
- $scope.model = '2'; // This works as an integer (2) but not as a string ('2')
- $scope.options = [
- {id: 1, text: '11111'},
- {id: 2, text: '22222'}, // I want this option to be selected
- {id: 3, text: '33333'}
- ];
- });
Add Comment
Please, Sign In to add comment