2015-04-04 93 views
2

在我的测试中,我创建了手角控制器制造$scope

beforeEach(function() { 
    inject(function($controller, $rootScope) { 
    $scope = $rootScope.$new(); 
    controller = $controller('ContentController', {$scope: $scope}); 
    }); 
}); 

是否有必要每次打电话试运行后$scope.$destroy()

afterEach(function() { 
    $scope.$destroy(); 
}); 
+1

我从来没有做过,测试是短暂反正。除非您想要检查$ destroy事件的某些事件处理程序。 – Chandermani 2015-04-04 13:42:31

回答

相关问题