title: How to set value in dropdownboxlist in Angularjs?
body: <p>Hi I am developing web application in <code>angularjs</code>. I have one html form inside that i have dropdownboxlist. I have two scenarios here. First I am binding values to dropdown as below.</p>
  
  <pre><code>&lt;select ng-model="user.Nationality" 
           name="nationality" 
           id="Nationality" 
           ng-options="user.Nationality for user in nationalityList" 
           required&gt;
       &lt;option value="" label="Nationality"&gt;Nationality&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Second scenario is on page load previously selected data i want to bind if exists. If for some use already data for nationality for example if the user has selected nationality as India previously then on page load i want to bind only India to Dropdown.
  Below is my object receiving in api call.</p>
  
  <pre><code>"NationalitObj":
   {  
          "ID":1,
          "Nationality":"indian"
  },
  </code></pre>
  
  <p>Now i want to set Nationality as india for the above dropdoownboxlist.</p>
  
  <p>Below is the code how i am trying to set value for nationality.</p>
  
  <pre><code> $scope.nationalityList = PersonalInfo.NationalitObj;
   $scope.user.Nationality = $scope.nationalityList.Nationality;
  </code></pre>
  
  <p>This leads to error Cannot set property 'Nationality' of undefined. May i know how can i do this? Any help would be appreciated. </p>
  
  <p>Thanks in advance.</p>