title: Aliasing a model in ngtemplate
body: <p>I wish to alias a model used in a template such that the same template can be reused for different models. For instance in the following model:</p>
  
  <pre><code>member = {
  
      name: "Member1",
      children:[
      {
          name:"Child1"
      },
      {
          name:"Child2"
      }
      ]
  }
  </code></pre>
  
  <p>both "member" and "children" have "name" property. So I wish to create a single template manipulating this "name" property.
  I was able to achieve this with the help of this question:</p>
  
  <p><a href="https://stackoverflow.com/questions/15702411/bind-nginclude-to-different-models">Bind ngInclude to different models</a></p>
  
  <p>As suggested, I created a directive such as:</p>
  
  <pre><code>app.directive('member', function(){
  return {
      restrict: 'A',
      template: "{{prefix}}&lt;input type='text' ng-model='member.name'&gt;",
      scope: {
          member: "="
      }
  };
  });
  </code></pre>
  
  <p>Following is the usage of this directive:</p>
  
  <pre><code>&lt;div ng-controller="MemberCtrl"&gt;
      {{member | json}}
      &lt;div member="member"&gt;&lt;/div&gt;
      &lt;div member="member.children[0]"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I was able to achieve the template reuse, however since I'm using "scope" in my directive, this has created an isolated scope which is not able to access any property of the controller scope. So for the controller: </p>
  
  <pre><code>app.controller('MemberCtrl', function($scope){
  $scope.member = {
  
      name: "Member1",
      children:[
      {
          name:"Child1"
      },
      {
          name:"Child2"
      }
      ]
  };
  
      $scope.prefix = "Mr.";
  });
  </code></pre>
  
  <p>the template inside the directive is not able to access the "prefix" property. Following is the jsfiddle:</p>
  
  <p><a href="http://jsfiddle.net/vaibhavgupta007/mVBaC/1/" rel="nofollow noreferrer">http://jsfiddle.net/vaibhavgupta007/mVBaC/1/</a></p>
  
  <p>What could be the issue in this?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>I can also use $parent to access the prefix. But is this clean approach.</p>