2017-12-13 13 views
1

각도로 NavigationStart를 중지 할 수 있습니까? 사용자가 경로를 변경하려고하면 사용자 지정 확인 모달을 묻는 중입니다.각도 정지 라우터 NavigationStart

constructor(private router: Router) { 
    if(val instanceof NavigationStart){ 
     //prompt the confirmation modal and stop NavigationStart or at least 
      make it wait until user performs any action 
    } 
} 
당신은 경로를 방지 할 수
+1

https://angular.io/api/router/CanDeactivate –

+0

로 해결되었다 나는 멋진이 사용 canDeactive –

+1

@AkashAgrawal 해결 할 수 있었다 답변을 조정했다면 동의하십시오. – Baconbeastnz

답변

0

CanActivate 또는 CanDeactive 클래스

+0

CanActivate 또는 CanDeactivate 할 수 있습니까? 나는 경로 변경을 감지하고 싶다. –

+1

당신의 대답은 이슈에 대한 구체적인 해결책을 제시하지 못한다. 단지 힌트 일 뿐이다. –