gpt4 book ai didi

javascript - 错误: [$injector:modulerr] in Angular JS

转载 作者:行者123 更新时间:2023-12-02 15:41:43 24 4
gpt4 key购买 nike

我正在尝试使用 MEAN 堆栈创建应用程序。我的 Controller 代码如下所示。

var myApp = angular.module('myApp',[]);
myApp.controller('AppCtrl',['$scope', '$http', function($scope, $http){
console.log("Hello World from console");
}])();

我的index.html 看起来像这样:

    <!DOCTYPE>
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<title>
Contact List App</title>
</head>

<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script scr = "controllers/controller.js"></script>

<body ng-app = "myApp">
<div class = "container" ng-controller = "AppCtrl">
<h1>Contact List App</h1>

<table class= "table">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Number</th>
</tr>
</thead>
</table>
</div>
</body>
</html>

它抛出错误:[$injector:modulerr] 如果有人遇到此问题,请帮助我。

最佳答案

将调用运算符 () 从 Controller 末尾删除。

关于javascript - 错误: [$injector:modulerr] in Angular JS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32515970/

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