Angularjs 在生产中禁用调试数据 [英] Angularjs disabling debug data in production

查看:64
本文介绍了Angularjs 在生产中禁用调试数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照 angular 文档中的建议禁用生产服务器中的调试数据此处.补充一点,我并没有真正看到性能和加载时间有任何改善.这是我的代码在 app.js 中的样子.这是正确的做法吗?

I'm trying to disable debug data in production server as suggested in the angular docs here. Adding that I don't really see any improvement in performance and loading time. Here is how my code look in app.js. Is it the right way to do it?

angular.module('myApp',['toaster','ui.router','ui.bootstrap','myApp.controllers','myApp.directives','myApp.filters','myApp.services'])
.config(['$compileProvider', function ($compileProvider) {
  $compileProvider.debugInfoEnabled(false);
}]);

有没有办法检查调试信息是否被禁用?

Is there a way to check if debug info is disabled?

推荐答案

我真的没有看到性能和加载时间有任何改进.

I don't really see any improvement in performance and loading time.

是的,人类无法分辨几毫秒/我们的差异.

Yes, humans cannot tell the difference for few ms/us.

有没有办法检查调试信息是否被禁用?

Is there a way to check if debug info is disabled?

是的,检查调试信息类是否存在.

Yes, check existance of debug info classes.

document.querySelectorAll('.ng-scope,.ng-binding,.ng-isolate-scope').length === 0
// true

这篇关于Angularjs 在生产中禁用调试数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆