gpt4 book ai didi

javascript - Angular 指令获取 "Synchronous XMLHttpRequest on the main thread is deprecated"

转载 作者:行者123 更新时间:2023-11-28 05:55:27 25 4
gpt4 key购买 nike

我有一个嵌套在 Controller 内的 Angular 指令元素,我收到此消息

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. WARNING: Tried to load angular more than once.

我有点明白这意味着什么,但我不知道是什么导致了这个问题。这是我所拥有的:

音频.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'
};
}]);

最佳答案

抱歉,问题很简单,就是指令中的链接名称不正确。我应该有“displayTunerModal.html”。

这个故事的寓意:检查您的链接。

关于javascript - Angular 指令获取 "Synchronous XMLHttpRequest on the main thread is deprecated",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37737717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com