好的,所以我找到了很多可能导致您遇到此问题的原因。
首先请考虑使用$stateProvider 来声明您的状态并设置每个状态的控制器,这样它们就不会在运行应用程序时同时加载(不确定您是否刚刚将所有代码设置为一个文件向我们展示您拥有的东西)。但你知道在你的角度配置集中:
$stateProvider 使用示例:
$stateProvider
.state('app.page1', {
url: '/page1',
templateUrl: 'templates/page1.html',
controller: 'Page1Ctrl'
}
});
其次,您的代码中有很多错误/语法错误。我不确定您使用的是什么 IDE(编辑器),但请考虑添加一个 jshint 插件(您也可以通过在线 jshint @http://jshint.com/ 运行它)或如果可能的话与您的 IDE 类似的东西。它会指出代码中的错误。您的代码中的一些错误是:
- 在作用域变量和函数中缺少很多分号(这将导致 JavaScript 不知道下一步该去哪里等)
- 使用错误的 javascript 运算符,例如
resp.data.errors.email != undefined,应该是 resp.data.errors.email !== undefined
这也很糟糕:
moment($scope.iosDate.value.toISOString()).hour(7).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(8).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(9).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(10).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(11).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(12).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(13).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(14).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(15).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(16).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(17).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(18).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(19).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(20).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(21).minute(0).toISOString(),
moment($scope.iosDate.value.toISOString()).hour(22).minute(0).toISOString()
我想你可以通过其他方式做到这一点。
还要检查您的资源文件大小。例如,如果您使用的是背景图片、图标或类似内容,请检查它们是否过大。
这些是我在查看您的代码时首先想到的。请先尝试这些(至少更正代码中的错误),如果对您的问题有任何帮助,请告诉我。