2016-08-19 7 views
0

私はテンプレートでビデオを再生しています。しかし、私が状態を変えると、ビデオは引き続き再生されます。角度を変えたときにビデオを停止する

http://localhost:8000/app/#/practice

しかし、私はこれを変更する場合:

ビデオの再生はこちら

http://localhost:8000/app/#/adjust

第1の状態でビデオを再生したまま。

誰でも教えてください。

これは私の設定です:

.state('app.adjust',{ url: 'adjust', views:{ '[email protected]':{ templateUrl : 'views/adjust_lesson.html', controller : 'AdjustLesson' } } }) .state('app.practice',{ url: 'practice', views:{ '[email protected]':{ templateUrl : 'views/practice_lesson.html', controller: 'PracticeLesson' } } });

そして、これは 'PracticeLesson' コントローラが破壊されたときは、動画を停止することができ、私のindex.html内

<div ui-view = 'header'></div> <div ui-view = 'content'></div>

答えて

3

です。

'PracticeLesson'では、状態を変更するときにコントローラが 'AdjustLesson'に変更されたときに呼び出されます。

$scope.$on('$destroy', function() { 
    // anything here will be executed when this scope is destroyed. 
}); 
+0

優れています。その答えはうまくいった。ありがとうたくさん:D –

関連する問題