title: $templateCache to fancybox, how to bind variables to controller scope
body: <p>I have been struggling for a coupe of hours trying to get fancybox to display html template from <code>$templateCache</code>. It all works fine except for the annoying fact the the data binding does not work and I'm not sure how to solve it.</p>
  
  <pre><code>&lt;div ng-controller="MyCtrl"&gt;
      Hello, {{ templateVariable }}!
  
      &lt;script type="text/ng-template" id="testTemplate.html"&gt;
          &lt;h1&gt;{{ templateVariable }}&lt;/h1&gt;
          &lt;p&gt;Bla bla bla&lt;/p&gt;
      &lt;/script&gt;
  
      &lt;br /&gt;&lt;br /&gt;
      &lt;a href="#" show-template&gt;Show template&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <hr>
  
  <pre><code>var myApp = angular.module('myApp',[]);
  
  myApp.directive('showTemplate', function($templateCache, $compile, $parse) {
      return {
          restrict: 'A',
          link: function (scope, element, attrs, ctrl) {
              element.bind('click', function() {
                  var template = $templateCache.get('testTemplate.html');
                  var compiled = $compile(template)(scope);
                  $.fancybox.open(template);
              });
          }
      };
  });
  
  myApp.controller('MyCtrl', function($scope) {
      $scope.templateVariable = 'My template variable';
  });
  </code></pre>
  
  <p>JSFiddle:
  <a href="http://jsfiddle.net/oligustafsson/p4f7mh19/" rel="nofollow">http://jsfiddle.net/oligustafsson/p4f7mh19/</a></p>
  
  <p>Anyone have any insights to how to accomplish this feat?</p>