减少 AngularJS 应用程序问题



我有一个用AngularJS和Bootstrap编写的应用程序,运行良好,但是当我试图缩小它时,我遇到了问题。

我的应用程序的索引.html为:

<!DOCTYPE html>
<html lang="es-ES"  >
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Vebor Editor</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="css/style.min.css">
</head>
<body ng-app="editor"  ng-strict-di>
<header ng-include="'views/header.html'"></header>
<div class="container">
<div ui-view></div>
</div>
<footer class="footer" ng-include="'views/footer.html'"></footer>
<script src="/lib/angular/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-route.min.js"></script>
<script src="https://cdn.rawgit.com/angular-ui/ui-router/0.2.18/release/angular-ui-router.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-resource.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-animate.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-sanitize.min.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.5.0/ui-bootstrap-tpls.min.js"></script>
<script src="/js/scripts.min.js"></script>
</body>
</html>

我有 14 个不同的 js 文件,所以我不会在这里复制它们,如果您需要任何内容,请告诉我。主js文件是这样的:

(function(){
'use strict';
angular.module('editor', [
'ngMaterial', 'ngRoute',  'ngSanitize', 'ui.bootstrap', 'ui.router',
'editor.mainControllers', 'editor.searchControllers', 'editor.classControllers', 'editor.contactController', 'editor.viewerController', 'editor.listingControllers',
'editor.services', 'editor.serverCallsServices', 'editor.translationService'
]);
function config (...){...}
function run(...){...}
})();

首先,我在gulp中使用了uglify函数,以便使用style.min.css和script.min.js生成分发项目。

其次,我手动将js文件的全部内容复制到一个唯一的脚本中.js然后使用外部工具将其缩小。(即使使用统一文件也没有缩小,我遇到的问题也发生了)。

问题

这个问题很容易解释。页面未加载,这似乎是一个无限循环,因为控制台不显示任何内容,也没有 DOM。如果我重新加载页面,它仍然无法正常工作,我必须关闭选项卡并再次打开它。

由于没有来自浏览器的信息,我很迷茫。你知道为什么会这样吗?或者,也许我可以使用一些东西来尝试发现问题?

我已经知道 Angular 中的注入问题,并且我所有的控制器都具有适当的$inject。

如果我是你,我会尝试以不同的顺序加载文件。

这个答案可以帮助你。

最新更新