Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度JS错误角度JS:38未捕获错误:[$injector:modulerr]_Javascript_Jquery_Html_Angularjs_Node.js - Fatal编程技术网

Javascript 角度JS错误角度JS:38未捕获错误:[$injector:modulerr]

Javascript 角度JS错误角度JS:38未捕获错误:[$injector:modulerr],javascript,jquery,html,angularjs,node.js,Javascript,Jquery,Html,Angularjs,Node.js,在加载index.html时,我遇到了这个错误 index.html <html> <head>Testing <script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js" ></script> <script> var app = angular.module('myApp', []); app.controller('myCt

在加载index.html时,我遇到了这个错误

index.html

<html>
<head>Testing
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js" ></script>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope,$http) {
   $scope.submit= function(){
var data = {
  book: {            
    author: $scope.author,
    title : $scope.title,
    body : $scope.body
  }
}

$http.post("/", data).success(function(data, status) {
    console.log('Data posted successfully');
})
   }
});
</script>
</head>

<body ng-app="myApp">    
  <div ng-controller="myCtrl">
    <form>
      Author:
      <input type="text" ng-model="author">
      <br>
      <br> Title:
      <input type="text" ng-model="title">
      <br>
      <br> Body:
      <input type="author" ng-model="body">
      <br>
      <br>
      <input type="submit" value="Submit" ng-click="submit()">
    </form>
  </div>  
</body>
</html>
我得到的index.html是正确的,但在谷歌浏览器检查中,它显示了我的错误

angular.js:38未捕获错误:[$injector:moduler] $injector/modulerr?p0=myApp&p1=Error%3A%2…ogleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.5.6%2Fangular.min.js%3A21%3A332)

同样的代码在这里工作

var-app=angular.module('myApp',[]);
app.controller('myCtrl',函数($scope,$http){
$scope.submit=函数(){
风险值数据={
书籍:{
作者:$scope.author,
title:$scope.title,
body:$scope.body
}
}
$http.post(“/”,数据)。成功(函数(数据,状态){
log(“数据已成功发布”);
})
}
});

作者:


标题:

正文:


只需在angular.js脚本行之后添加这一行:

<script src="https://code.jquery.com/jquery-2.2.4.js"></script>


它会工作的。

您的代码在我们的机器上运行良好

正如您在一条评论中所说的,您总是在获取旧文件,这应该是
缓存问题

如果是缓存问题,请在chrome中执行清除缓存的步骤

1) Open Chrome.
2) On your browser toolbar, tap More .
3) Tap History, and then tap Clear browsing data.
4) Under "Clear browsing data," select the checkboxes for Cookies and site data and Cached images and files.
5) Use the menu at the top to select the amount of data that you want to delete. ...
6) Tap Clear browsing data.
如果要从代码中删除缓存视图

app.run(function($rootScope, $templateCache) {
    $rootScope.$on('$routeChangeStart', function(event, next, current) {
        if (typeof(current) !== 'undefined'){
            $templateCache.remove(current.templateUrl);
        }
    });
});

你也可以

1) Open your browser console
2) Go to network tab
3) Refresh the page
4) While refreshing, right click on network tab and click on, clear browser cookies, then press alt+f5

我想你必须加载javascript库文件,请检查我应该加载哪个javascript文件?我已经包含angular.min.js@AshishPatelJquery了?我没有在我的代码中使用这个答案没有意义,你应该在评论中添加plunkr,并要求OP提供更多信息inputs@sajeetharan这是否意味着我应该尝试使用另一个名为script的文件。js@AbhishekParikh无需查看此处@AbhishekParikh检查您的angular脚本文件是否加载到网络tab200文件中找到angular.min.jsI已尝试删除所有旧数据我的密码,所有浏览器仍以某种方式加载我的旧数据旧文件是什么意思?
html
data
?旧的html和js文件打开浏览器控制台,转到网络选项卡,刷新页面,在刷新时,右键单击
网络选项卡
,然后单击,
清除浏览器cookie
,然后按
alt+f5
好的,每次您遇到缓存问题,尝试上述注释中的步骤。
1) Open your browser console
2) Go to network tab
3) Refresh the page
4) While refreshing, right click on network tab and click on, clear browser cookies, then press alt+f5