gpt4 book ai didi

angularjs - 使用 ng-view 时出现scrollTo错误

转载 作者:行者123 更新时间:2023-12-03 06:54:44 25 4
gpt4 key购买 nike

第一次将 ng-view 与 Angular 一起使用,并且在 Angular js 与 ng-view 的新应用程序中,我遇到了所有这些滚动错误。我怎样才能解决这个问题?我检查了 StackOverflow 和 Google,但找不到解决方案。即使是 Angular 种子应用程序我也遇到了同样的问题。

控制台错误

TypeError: Property 'scrollTo' of object [object global] is not a function
at scroll (http://localhost/angular/lib/angular.js:2946:26)
at Object.Scope.$eval (http://localhost/angular/lib/angular.js:8685:28)
at Object.Scope.$digest (http://localhost/angular/lib/angular.js:8548:23)
at Object.Scope.$apply (http://localhost/angular/lib/angular.js:8771:24)
at http://localhost/angular/lib/angular.js:986:15
at Object.invoke (http://localhost/angular/lib/angular.js:2873:25)
at resumeBootstrapInternal (http://localhost/angular/lib/angular.js:984:14)
at bootstrap (http://localhost/angular/lib/angular.js:998:12)
at angularInit (http://localhost/angular/lib/angular.js:959:5)
at http://localhost/angular/lib/angular.js:16310:5 angular.js:6173
TypeError: Property 'scrollTo' of object [object global] is not a function
at scroll (http://localhost/angular/lib/angular.js:2946:26)
at <error: illegal access>
at Object.Scope.$broadcast (http://localhost/angular/lib/angular.js:8935:28)
at http://localhost/angular/lib/angular.js:7960:26
at wrappedCallback (http://localhost/angular/lib/angular.js:7303:59)
at wrappedCallback (http://localhost/angular/lib/angular.js:7303:59)
at http://localhost/angular/lib/angular.js:7340:26
at Object.Scope.$eval (http://localhost/angular/lib/angular.js:8685:28)
at Object.Scope.$digest (http://localhost/angular/lib/angular.js:8548:23)
at Object.Scope.$apply (http://localhost/angular/lib/angular.js:8771:24)

用我的文件中的内容进行了更新,正如您所看到的,它只是全新的应用程序。

index.html

<!doctype html>
<html lang="en" ng-app="app">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<title>Mobile App</title>
<link href="css/default.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap-min.css" rel="stylesheet" type="text/css">
</head>
<body>

<div ng-view></div>

<!--<script src="lib/angular-min.js"></script>-->
<script src="lib/angular.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/directives.js"></script>
<script src="js/services.js"></script>

</body>
</html>

app.js

var app = angular.module('app', ['Controllers', 'Directives', 'Services']);

controllers.js

angular.module('Controllers', []);

directives.js

angular.module('Directives', []);

services.js

angular.module('Services', []);

最佳答案

初步研究表明,问题可能出在 chrome 弹出窗口阻止程序上,禁用他可能会解决问题。请尝试在除 Chrome 之外的任何浏览器中运行您的应用,如果您看到其他行为,只需禁用弹出窗口阻止程序即可。

希望有帮助。

干杯

关于angularjs - 使用 ng-view 时出现scrollTo错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16134747/

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