0
在我的主控制器,我已經得到了切換真/假的全屏瀏覽器狀態,像這樣的功能:角和HTML5全屏API
// Full Screen toggle
$scope.fsState = false;
$scope.fullScreen = function fullScreen(){
function launchFS(element) {
if (element.requestFullScreen) element.requestFullScreen();
else if (element.mozRequestFullScreen) element.mozRequestFullScreen();
else if (element.webkitRequestFullScreen) element.webkitRequestFullScreen();
}
function cancelFS() {
if (document.cancelFullScreen) document.cancelFullScreen();
else if (document.mozCancelFullScreen) document.mozCancelFullScreen();
else if (document.webkitCancelFullScreen) document.webkitCancelFullScreen();
}
if($scope.fsState == false) launchFS(document.documentElement);
else cancelFS(); $scope.fsState = !$scope.fsState;
};
並在視圖...
<button class="btn" ng-click="fullScreen()">Toggle Fullscreen</button>
這工作正常,除了當我導航到SPA內的另一頁。每次我從主導航菜單(也在同一個控制器中)進行選擇時,頁面會跳出全屏。任何想法爲什麼Angular.js正在這樣做,或者可以做什麼,所以它維護路線變化之間的狀態?