使用ng-view时有scrollTo错误

时间:2013-04-21 18:34:37

标签: angularjs

首次使用带有Angular的ng-view和使用ng-view的角度js的新应用程序我有所有这些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) 

更新了我在文件中的内容,正如您所看到的那样新鲜的应用程序。

的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', []);

2 个答案:

答案 0 :(得分:5)

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

希望有所帮助。

干杯

答案 1 :(得分:1)

FYI, here's the ticket for it in better popup blocker's issue tracker.自2011年以来,开发人员一直没有触及它,所以它似乎不会很快得到修复。