title: angularjs directive binding name attribute to template element
body: <p>I am trying create a wrapper directive over select and I am trying to assign the 'name 'attribute to the select</p>
  
  <p>directive</p>
  
  <pre><code>    &lt;form name=myform&gt;
            &lt;selectformfield label="Select Orders" id="id_1" name="orderselection"
              selectedval="obj.order" options="Orders" /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>I have my directive defined as </p>
  
  <pre><code>mainApp
      .directive(
              'selectformfield',
              function() {
                  return {
                      restrict : 'E',
                      transclude : true,
                      scope : {
                          label : '@',
                          id : '@',
                          selectedval : '=',
                          options : '=',
                          name: '='
                      },
                        template : "&lt;select class='form-control'     ng-model='selectedval' name='{{name}}' ng-options='item as item.name for item in options' required&gt;&lt;option value=''&gt;-- select --&lt;/option&gt;&lt;/select&gt;"
  
                  };
              });
  </code></pre>
  
  <p>I am trying to access the select's name attribute through myform in the controller  something like console.log($scope.myForm.orderselection) and I get undefined</p>
  
  <p>If I hardcode the name in the directive then I am able to access the attribute console.log($scope.myForm.orderselection) </p>
  
  <p>I am missing anything here. Do I have to do any post compile or something ?</p>