title: How to $compile an AngularJS template using a newly created scope?
body: <p>I am creating a pop-up modal that I want to have the capabilities of being updated dynamically using a newly created <code>$scope</code>. I want to do something like this:</p>
  
  <pre><code>var myNewScope = $scope.$new();
  myNewScope.name = 'Jack';
  
  ModalService.open('Hello, {{ name }}', myNewScope);
  </code></pre>
  
  <p>Then in my <code>ModalService.open</code> method I want to compile that string with the given scope like this</p>
  
  <pre><code>// ... other service stuff
  
  service.open = function(template, scope){
      var compiledText = $compile(template)(scope);
      // I want compiledText = 'Hello, Jack'
  }
  </code></pre>