ngOptions treats a model viewValue of 0 as the unknown option, resulting in the proper value of the select not being selected #10115
Description
If you define a select using a model with a value of 0, the "unknown option" will get added to the list and the proper selection in the will not be chosen. The problem is this line in self.removeOption: https://github.com/angular/angular.js/blob/master/src/ng/directive/select.js#L215 if (ngModelCtrl.$viewValue == value) { The double-equals check ends up evaluating 0 against the empty string, which succeeds and causes the "unknown option" to be rendered. This needs to be triple-equals, so that 0 really means 0. I strongly suspect that the same should be the case in self.addOption in a similar circumstance. However, I have not found a situation in which the addOption code was problematic (which doesn't mean that none exists). This bug exists minimally in 1.3.3 and 1.2.26.