title: Why does this have $rootscope.$new()?
body: <p>I am researching how to use Jasmine with Karma. I am trying to inject a scope into my controller and from somewhere I have picked up this code...</p>
  
  <pre><code>var scope = { message: 'hello' };
  
  beforeEach(angular.mock.module('myApp'));
  
  beforeEach(angular.mock.inject(function ($rootScope, $controller) {
  
      scope = $rootScope.$new();
  
      $controller('myController', { $scope: scope });
  
  }));
  </code></pre>
  
  <p>The problem is that the scope is being wiped out with the line...</p>
  
  <pre><code>scope = $rootScope.$new();
  </code></pre>
  
  <p>So I can comment it out but I am wondering what the use of this line is for? When would I want to call <code>$rootscope.$new()</code>? I understand it is to do with isolation but I don't really get the practical applications of it.</p>
  
  <p>UPDATE : As Tim points out below it is a problem because I have declared my own scope. So I can modify the code to be ....</p>
  
  <pre><code>var scope;
  
  beforeEach(angular.mock.module('myApp'));
  
  beforeEach(angular.mock.inject(function ($rootScope, $controller) {
  
      scope = $rootScope.$new();
  
      scope.message = 'hello';
  
      $controller('myController', { $scope: scope });
  
  }));
  </code></pre>
  
  <p>And that works more like expected, but I am still wondering what the best approach is? What is <code>$rootscope.$new()</code> even for?</p>