Uncaught Error: [$injector:modulerr] angular出现错误解决方案

angular.min.js:2 Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.9/$injector/modulerr?p0=youlexuan&p1=Error%3A%20%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.2.9%2F%24injector%2Fmodulerr%3Fp0%3Dpagination%26p1%3DError%253A%2520%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.2.9%252F%2524injector%252Fnomod%253Fp0%253Dpagination%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A2%253A449%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A16%253A260%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A17%253A262%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A25%253A175%250A%2520%2520%2520%2520at%2520Array.forEach%2520(%253Canonymous%253E)%250A%2520%2520%2520%2520at%2520q%2520(http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A3%253A274)%250A%2520%2520%2520%2520at%2520e%2520(http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A25%253A115)%250A%2520%2520%2520%2520at%2520http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A25%253A192%250A%2520%2520%2520%2520at%2520Array.forEach%2520(%253Canonymous%253E)%250A%2520%2520%2520%2520at%2520q%2520(http%253A%252F%252Flocalhost%253A9101%252Fplugins%252Fangularjs%252Fangular.min.js%253A3%253A274)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A2%3A449%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A26%3A1%0A%20%20%20%20at%20Array.forEach%20(%3Canonymous%3E)%0A%20%20%20%20at%20q%20(http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A3%3A274)%0A%20%20%20%20at%20e%20(http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A25%3A115)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A25%3A192%0A%20%20%20%20at%20Array.forEach%20(%3Canonymous%3E)%0A%20%20%20%20at%20q%20(http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A3%3A274)%0A%20%20%20%20at%20e%20(http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A25%3A115)%0A%20%20%20%20at%20%24b%20(http%3A%2F%2Flocalhost%3A9101%2Fplugins%2Fangularjs%2Fangular.min.js%3A28%3A232)
    at angular.min.js:2
    at angular.min.js:26
    at Array.forEach ()
    at q (angular.min.js:3)
    at e (angular.min.js:25)
    at $b (angular.min.js:28)
    at c (angular.min.js:13)
    at Zb (angular.min.js:14)
    at Tc (angular.min.js:13)
    at HTMLDocument. (angular.min.js:197)

在使用angular回填后台数据是出现数据无法回填,而且页面中引用的其他文件都可以被正确的加载,但是对于的回填数据的某个方法却无法发送请求到后端!
前端的angular对于的代码

var app = angular.module('youlexuan',['pagination']);

app.service('loginService',function($http) {
    this.showLoginName=function () {
        return $http.get('../login/name.do');
    }

})
app.controller('indexController',function($scope,loginService){
    $scope.showName = function () {
        loginService.showLoginName().success(
            function(response) {
                $scope.loginName = response.loginName;
                alert(response.loginName)
            })
    }
})

代码功能,前端页面加载时发送请求获得登入用户的信息,将数据显示在页面上,形成动态获取数据的功能。

执行前端代码时,会出现无法显示数据,报:Uncaught Error: [$injector:modulerr]
模板注入错误,但是页面的js文件能够正确加载
在这里插入图片描述
于是点击angular.js文件跟进,查看控制台中的错误信息。
Uncaught Error: [$injector:modulerr] angular出现错误解决方案_第1张图片
进去看到angula.js文件中出现错误:return Error(a)}}function rb(b){if(null==b||Aa(b))return!1;
出现这个错误是,对应与使用了Angular的分页功能,但是却没有其他对应的功能文件:angular分页js和css
在这里插入图片描述
解决方案:
1.去除分页功能:在这里插入图片描述
2.页面中添加对应的分页文件:


	
	

你可能感兴趣的:(前端)