title: Setting default value for <select/> using ng-options with (key, value) in angularjs
body: <p>I want to set a default value for the following select:</p>
  
  <pre><code>&lt;select ng-model="selected"
        ng-options="key as value.Name for (key, value) in attributes"&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I use <code>attributes</code> as a map with an id as key and an object as value. I want to show the name of the value in the select-box, but bind the key to the model, because when I access <code>selected</code>, I need the id, not the name. 
  This works but now I want to set a default value. The default value must also show <code>value.Name</code>, but bind <code>id</code>.</p>
  
  <p>According to <a href="https://docs.angularjs.org/api/ng/directive/select" rel="nofollow noreferrer">this</a>, it should work something like this:</p>
  
  <pre><code>$scope.selected = { 1: {Name : "Attribute1"}};
  </code></pre>
  
  <p>I haven't made it yet. I would appreciate any help.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>My attributes variable looks like this (TypeScript):</p>
  
  <pre><code>export interface IAttributes {
      [id: number]: IAttributeProperties;
  }
  
  export interface IAttributeProperties {
      Name: string;
      DataType: string;
  }
  </code></pre>