stateChangeStart
は起動されません。ブラウザのリフレッシュ前に発生する可能性のある角度のイベントです。リフレッシュページでは、
this.scope.$on('$stateChangeStart', (event, next, current) => {
if(!confirm("Are you sure you want to refresh this page?")) {
event.preventDefault();
}
});
stateChangeSuccess
ページの更新がすでに行われている場合にのみ起動されます。
更新前にどのイベントが発生するのですか?
UPDATE: が、これは私のコードの一部であり、私の場合 で働いていないwindow.onbeforeunload
を試してみましたが、その権利がありますか?
export default class TableController {
constructor($scope,$state, $location) {
//some initialization here
window.onbeforeunload = function() {
console.log('onbeforeunload');
debugger;
return null;
}
}
//other coll functions
...
}
statechangestartは、$( '$ stateChangeStart' に。.. $ rootScope、このようにルートスコープに起こる機能(E、toStateプロパティ、toParams、fromStateプロパティ、fromParams){ 場合(toState.module === 'private' &&!$ cookies.Session){ – Nagappan