2013-12-17 2 views
0

app.run (function() {})에서 전체 응용 프로그램 실행을 일시 중지하는 방법은 무엇입니까? 예를 들어angularjs 응용 프로그램 실행 일시 중지

: 당신은 당신이 ng-app="frontendApp" 사용하여 응용 프로그램을 부트 스트랩하는 수없는 경우

angular.module('frontendApp') 
    .run(function ($timeout) { 
    $timeout(function() { 
     next(); // While this function is not executed, 
       // the application must not download data and perform any task. 
    }, 1000); 
    }); 
+0

어떤 경우에 해당 하는가? –

+0

어떻게 해야할지 모르겠다. =) –

답변

1

.

수동 부트 스트랩으로는 가능할 수도 있습니다. 대신 당신의 HTML에 ng-app의, 스크립트에서이 같은 것을 사용 :이 또한 angular.resumeBootstrap()를 호출 할 수있는 DEFFERED 부트 스트랩 과정,하지만 난이 테스트에 적용 할 생각

angular.element(document).ready(function() { 
    //Bootstrap the application after 3 seconds 
    setTimeout(function() { 
     angular.bootstrap(document, ['frontendApp']); 
    }, 3000); 
}); 

.

여기에 더 많은 정보 : http://docs.angularjs.org/guide/bootstrap

+0

뷰를로드하는 것을 일시 중지 할 수는 없지만 서비스를로드 할 수 있습니까? –

+0

이것은 기본적으로 각도의 부트 스트래핑 프로세스를 길게하므로 아무 것도 작동하지 않습니다. 즉, 명령이 컴파일되지 않고 서비스가 생성되지 않습니다. 지시문 *이 포함 된 HTML 페이지가로드됩니다. – shizik

관련 문제