<option value="? undefined:undefined ?" selected="selected"></option>

< option value="? undefined:undefined ?" selected="selected" >

Why does AngularJS include an empty option in select?
Adding ng-model to predefined Select element adds undefined option -

AngularJs overrides the "selected" property when we bind the select to a model. If we inspect the rendered DOM we will find that a new item has been added i.e.

 <option value="? undefined: undefined ?"></option>

I think ?undefined:undefined ? should not be set as value. When a user choose nothing they ? undefined: undefined ? will be submitted as value.

You could just initialize it using ng-init such as in the below examples.

Defining that model in the controller -

    var myApp = angular.module('myApp', [])
        .controller('MyCtrl', ['$scope', function ($scope) {
            $scope.selectedOption = 1;

And other example is -
<div ng-init="selectedOption=1">#TODO</div>

And it looks like -
<select ng-model="selectedOption" required="required" ng-init="selectedOption='1'"
        ng-options="option.value as option.name for option in typeOptions"></select>

Other one example is -
<select ng-model="selectedOption" required="required"
        ng-options="option.value as option.name for option in typeOptions">

    <option style="display:none" value="">select a type</option>

Other one example is -
<select ng-options="option.value as option.name for option in typeOptions">
    <option value="" ng-if="false"></option>

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

< option value="? undefined:undefined ?" selected="selected" > < option value="? undefined:undefined ?" selected="selected" ></ option> Reviewed by Anil Singh on 2:42 AM Rating: (5)
www.code-sample.com/. Powered by Blogger.