3

第一次将 ng-view 与 Angular 一起使用,并在 Angular js 与 ng-view 的全新应用程序中,我遇到了所有这些 scrollTo 错误。我怎样才能解决这个问题?我检查了 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) 

如您所见,它更新了我的文件中的内容,因为它只是新的应用程序。

索引.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>

应用程序.js

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

控制器.js

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

指令.js

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

服务.js

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

2 回答 2

5

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

希望有帮助。

干杯

于 2013-04-21T20:39:09.943 回答
1

仅供参考,这是更好的弹出窗口阻止程序的问题跟踪器中的票。自 2011 年以来开发人员未对其进行任何修改,因此它似乎不会很快得到修复。

于 2014-01-30T13:41:05.703 回答