Q:

Angularjs - TypeError: Cannot read property 'name' of undefined" when work with dropdown

 <select id="ddlPropertyName" ng-options="property. Name for property in allProperty" ng-model="property. Name"><option value="">-Select Name-</option>
                            </select>

If there no value selected in dropdown i'm getting below error :(
TypeError: Cannot read property 'name' of undefined" 
js code
    Name: $scope.property. Name. Name

But I want if no value gets selected still I can check undefined or null so that my Json can set value and code execute without execption

A:

Use some other model variable instead of property.  Here in the modified HTML I have used selectedProperty
<select id="ddlPropertyName" 
    ng-options="property. Name for property in allProperty" 
    ng-model="selectedProperty">
    <option value="">-Select Name-</option>
</select>

Note: You are using label for value in array in ngOption so selectedProperty will hold the property type

