{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/11727","labels_url":"https://api.github.com/repos/angular/angular.js/issues/11727/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/11727/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/11727/events","html_url":"https://github.com/angular/angular.js/issues/11727","id":70947157,"number":11727,"title":"Predefined model value and ng-options later binding","user":{"login":"osmirnov","id":454196,"avatar_url":"https://avatars.githubusercontent.com/u/454196?v=3","gravatar_id":"","url":"https://api.github.com/users/osmirnov","html_url":"https://github.com/osmirnov","followers_url":"https://api.github.com/users/osmirnov/followers","following_url":"https://api.github.com/users/osmirnov/following{/other_user}","gists_url":"https://api.github.com/users/osmirnov/gists{/gist_id}","starred_url":"https://api.github.com/users/osmirnov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osmirnov/subscriptions","organizations_url":"https://api.github.com/users/osmirnov/orgs","repos_url":"https://api.github.com/users/osmirnov/repos","events_url":"https://api.github.com/users/osmirnov/events{/privacy}","received_events_url":"https://api.github.com/users/osmirnov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-25T18:14:18Z","updated_at":"2015-04-26T09:59:19Z","closed_at":null,"body":"I have the issue with Angular.js v1.3.11 and ng-options directive. The problem is next. I have a model value I know ahead but data for binding of options comes in Ajax request later and Angular.js produces that as two selected options: with my value and first one.\r\n\r\nHtml\r\n\r\n      <body ng-controller=\"MainCtrl\">\r\n          <select ng-model=\"selectedYear\" ng-options=\"o.year as o.year for o in options\"></select>\r\n      </body>\r\n\r\nJavascript\r\n\r\n    var app = angular.module('plunker', []);\r\n\r\n    app.controller('MainCtrl', function($scope, $timeout) {\r\n        // Known value for preselection\r\n        $scope.selectedYear = 2013;\r\n        $scope.options = [];\r\n\r\n        // Ajax call emulation\r\n        $timeout(function() {\r\n            $scope.options = [{year: 2012}, {year: 2013}, {year: 2014}];\r\n        });\r\n    });\r\n\r\nOutput\r\n\r\n    <select ng-model=\"selectedYear\" ng-options=\"o.year as o.year for o in options\" class=\"ng-pristine ng-valid ng-touched\">\r\n       <option value=\"0\" selected=\"selected\" label=\"2012\">2012</option>\r\n       <option value=\"1\" selected=\"selected\" label=\"2013\">2013</option>\r\n       <option value=\"2\" label=\"2014\">2014</option>\r\n    </select>\r\n\r\nPlunker\r\nhttp://plnkr.co/edit/gFZ8Z7T5DhDPvk4G9tEU?p=preview\r\n\r\nStackoverflow\r\nhttp://stackoverflow.com/questions/29858677/predefined-model-value-and-ng-options-later-binding/"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/96358343","html_url":"https://github.com/angular/angular.js/issues/11727#issuecomment-96358343","issue_url":"https://api.github.com/repos/angular/angular.js/issues/11727","id":96358343,"user":{"login":"gkalpak","id":8604205,"avatar_url":"https://avatars.githubusercontent.com/u/8604205?v=3","gravatar_id":"","url":"https://api.github.com/users/gkalpak","html_url":"https://github.com/gkalpak","followers_url":"https://api.github.com/users/gkalpak/followers","following_url":"https://api.github.com/users/gkalpak/following{/other_user}","gists_url":"https://api.github.com/users/gkalpak/gists{/gist_id}","starred_url":"https://api.github.com/users/gkalpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkalpak/subscriptions","organizations_url":"https://api.github.com/users/gkalpak/orgs","repos_url":"https://api.github.com/users/gkalpak/repos","events_url":"https://api.github.com/users/gkalpak/events{/privacy}","received_events_url":"https://api.github.com/users/gkalpak/received_events","type":"User","site_admin":false},"created_at":"2015-04-26T09:59:19Z","updated_at":"2015-04-26T09:59:19Z","body":"FWIW, it works as expected on v1.4.0-rc.1."}}