1

에서 각도 수정 나는 다음 각 컨트롤러 Players는 angular.value() 제공 업체 인각도기

.... 
.controller('EndCtrl', ['$scope', '$location', 'Players', function($scope, $location, Players) { 
    console.log('players', Players); 
    $scope.players = Players; 
    $scope.go = function (path) { 
     Players = []; 
     $location.path(path); 
    }; 
}]); 

에게 있습니다. 내가 아무것도 페이지 따라서

에서 발생하기 전에 Players을 설정해야 각도기 테스트를 실행하기 위해 노력하고있어

.... 그러나

..... 
beforeEach(function(){ 
    browser.get('#/end'); 
    browser.waitForAngular(); 
    browser.executeScript(function(json) { 
     var mod = angular.module('myApp.players'); 
     mod.run(['Players', function(Players){ 
      Players = [json.characters[0], json.characters[1]]; 
      console.log(Players, 'player browser'); 
     }]); 
     console.log('player browser', mod); 
    }, json); 

    }); 

는 테스트를 실행에 보인다 사실 이후에 처형된다. 내가 컨트롤러가 실행되기 전에 값을 설정해야

....

+1

'browser.waitForAngular();를'mod.run()'명령 다음으로 옮겨보십시오. –

답변

1

당신은 EndCtrl 초기화하기 전에 Players을 수정해야합니다.

다른보기에서 그렇게하지 마시고 마지막 페이지로 이동하는 링크를 클릭하십시오 (EndCtrl).

변형 된 Players이 주입됩니다.