title: Angular directive template unknown scope
body: <p>I know there is a lot of questions and posts about AngularJS and how directives are supposed to be used. And I got mine working just fine until I got another problem which I don't know how to resolve.</p>
  
  <p>I use a directive on a custom HTML element. Directive transforms this element into a regular html tree as defined in a template. The HTML element has some attributes which are used when building the template. Data for one of the elements is received with HTTP request and is successfully loaded. This is the part which I got working fine.</p>
  
  <p>Now I want to do something more. <a href="https://plnkr.co/UFbD5B0wf2kgYsWYpDBX" rel="nofollow">I've created a plunker which is an example of what I want to achieve.</a> It's a fake one, but illustrates my problem well.</p>
  
  <p>index.html:</p>
  
  <pre><code>&lt;body ng-controller="MainCtrl"&gt;
      &lt;div id="phones"&gt;
          &lt;phone brand="SmartBrand" model="xx" comment="blah"&gt;&lt;/phone&gt;
          &lt;phone brand="SmarterBrand" model="abc" comment="other {{dynamic.c1}}"&gt;&lt;/phone&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Angular directive:</p>
  
  <pre><code>app.directive('phone', function() {
      return {
          restrict: 'E',
          replace: true,
          scope: {
              'comment': '@',
              'brand': '@'
          },
          templateUrl: 'customTpl.html',
          controller: function($scope) {
              fakeResponse = {
                  "data": {
                      "success": true,
                      "data": "X300",
                      "dynamic": {
                          "c1": "12",
                          "c2": "1"
                      }
                  }
              }
              $scope.model = fakeResponse.data.data;
              $scope.dynamic = fakeResponse.data.dynamic;
          }
      }
  });
  </code></pre>
  
  <p>Template:</p>
  
  <pre><code>&lt;div class="phone"&gt;
      &lt;header&gt;
          &lt;h2&gt;{{brand}} &lt;strong&gt;{{model}}&lt;/strong&gt;&lt;/h2&gt;
      &lt;/header&gt;
      &lt;p&gt;Comment: &lt;strong&gt;{{comment}}&lt;/strong&gt;&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So I would like to be able to customize one of the tags in the element (phone comment in this example). The trick is that the number of additional info that is going to be in the tag may vary. The only thing I can be sure of is that the names will match the ones received from AJAX request. I can make the entire comment be received with AJAX and that will solve my problem. But I want to separate template from the variables it is built with. Is it possible?</p>