我有嵌套在控制器內的角指令元素,我得到這個消息角指令得到「主線程同步的XMLHttpRequest已過時」
同步XMLHttpRequest的主線程在其有害的,因爲已經過時影響最終用戶的體驗。如需更多幫助,請查詢https://xhr.spec.whatwg.org/。 警告:試圖加載角度不止一次。
我有點明白它是什麼意思,但我不知道是什麼導致了這個問題。下面是我有:
audio.html
<div class="audio-top-bar" ng-controller="AudioController">
<div class="audio-tuner-button" ng-click="displayTunerModal()">
<button class="btn">
<p class="audio-tuner-type">{{tunerButton}}</p>
</button>
</div>
<display-tuner-modal ng-show="visibility"></display-tuner-modal>
</div>
AudioController.js
angular.module('app').controller('AudioController', ['$scope', 'TunerService', function($scope, TunerService){
$scope.visibility = false;
if ($scope.tunerButton == (null || undefined))
$scope.tunerButton = 'FM';
$scope.displayTunerModal = function(){
$scope.visibility = true;
};
}]);
displayTunerModal.js
angular.module('app').directive('displayTunerModal', ['TunerService' , function (TunerService){
return {
restrict: 'E',
link: function(scope, elem, attrs){
scope.displayTunerModal = function(){
console.log("CLICKED");
};
},
templateUrl: 'public/templates/displayScreenModal.html'
};
}]);
顯示的代碼中沒有任何內容與Ajax有關,這就是XMLHttpRequest被稱爲的內容。 – charlietfl
我的問題很簡單,就像鏈接名稱不正確一樣簡單。我應該有「displayTunerModal.html」。 –