好的,首先我尝试搜索并做了解决方案,但无济于事
我尽我所能。我还添加了角度资源,但错误加倍,所以我删除了它。无论如何我错过了什么?我有一段时间没有使用角度,所以这对我来说有点棘手
这是我的 app.js
angular.module('chad',['ngRoute','UserManagementController','angularUtils.directives.dirPagination','oitozero.ngSweetAlert','appRoutes',"ui.materialize"]);
这是我的 appRoutes.js
angular.module('appRoutes',[]).config(['$routeProvider','$locationProvider', function($routerProvider,$locationProvider){
$routerProvider
.when("/chad/index",{
templateUrl:'index.html',
controller: 'UserManagementController'
})
.otherwise({redirectTo: '/'}
);
$locationProvider.html5Mode(true);
}]);
这是我的脚本
<link href="css/materialize.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="css/style.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<!-- Custome CSS-->
<link href="css/custom/custom.min.css" type="text/css" rel="stylesheet" media="screen,projection">
<!-- INCLUDED PLUGIN CSS ON THIS PAGE -->
<link href="js/plugins/prism/prism.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="js/plugins/perfect-scrollbar/perfect-scrollbar.css" type="text/css" rel="stylesheet"
media="screen,projection">
<link href="css/userManagementCss.css" type="text/css" rel="stylesheet" media="screen,projection">
<link href="js/plugins/sweetalert/dist/sweetalert.css" type="text/css" rel="stylesheet" media="screen,projection">
<script type="text/javascript" src="js/plugins/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="libs/angular/angular.min.js"></script>
<script type="text/javascript" src="libs/angular-route/angular-route.min.js"></script>
<script type="text/javascript" src="libs/angular-utils-pagination/dirPagination.js"></script>
<script type="text/javascript" src="js/controller/UserManagementController.js"></script>
<script type="text/javascript" src="js/appRoutes.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/plugins/jquery-1.11.2.min.js"></script>
<!--materialize js-->
<script type="text/javascript" src="js/materialize.min.js"></script>
<!--prism-->
<script type="text/javascript" src="js/plugins/prism/prism.js"></script>
<script type="text/javascript" src="js/plugins/angular-materialize.js"></script>
<!--scrollbar-->
<script type="text/javascript" src="js/plugins/perfect-scrollbar/perfect-scrollbar.min.js"></script>
<!-- chartist -->
<script type="text/javascript" src="js/plugins/sweetalert/dist/sweetalert.min.js"></script>
<!--plugins.js - Some Specific JS codes for Plugin Settings-->
<script type="text/javascript" src="js/plugins.min.js"></script>
<!--custom-script.js - Add your own theme custom JS-->
<script type="text/javascript" src="js/custom-script.js"></script>
我错过了剧本还是什么?
我坚持这个:(
angular.js:14328 Error: [$injector:unpr] Unknown provider: SweetAlertProvider <- SweetAlert <- UserManagementController
http://errors.angularjs.org/1.6.1/$injector/unpr?p0=SweetAlertProvider%20%3C-%20SweetAlert%20%3C-%20UserManagementController
at angular.js:68
at angular.js:4630
at Object.getService [as get] (angular.js:4783)
at angular.js:4635
at getService (angular.js:4783)
at injectionArgs (angular.js:4808)
at Object.invoke (angular.js:4834)
at $controllerInit (angular.js:10695)
at nodeLinkFn (angular.js:9572)
at compositeLinkFn (angular.js:8881)
答案 0 :(得分:0)
您错过了在appRoutes模块中注入NgRoute
angular.module('appRoutes',['ngRoute']).config(['$routeProvider','$locationProvider', function($routerProvider,$locationProvider){
$routerProvider
.when("/chad/index",{
templateUrl:'index.html',
controller: 'UserManagementController'
})
.otherwise({redirectTo: '/'}
);
$locationProvider.html5Mode(true);
}]);
答案 1 :(得分:0)
我相信你在正确加载脚本时搞砸了。 订单重要
您的jQuery脚本已加载两次。
<script type="text/javascript" src="js/plugins/jquery-1.11.2.min.js"></script>
您的app.js
在 materialize
和其他插件之前已加载,因此无法找到其中的一些,并且无法将这些插件注入应用。
app.js
应该在最后一个可用的脚本之后(可能在 sweetalert.min.js
之后?)