我正在尝试对我的配置进行一些小的调整,希望能稍微提高性能。我通读了 Angular 文档 here,他们提到禁用注释和 CSS 类指令。我尝试在我的配置中使用以下代码执行此操作,但我不断收到 TypeError: $compileProvider.commentDirectivesEnabled is not a function
或 TypeError: $compileProvider.cssClassDirectivesEnabled is not a function
错误。
注意:我正在运行 Angular 1.4.9
'use strict';
angular.module('app')
.config(compilationConfig)
;
compilationConfig.$inject = ['$compileProvider'];
function compilationConfig($compileProvider) {
$compileProvider.debugInfoEnabled(false);
$compileProvider.commentDirectivesEnabled(false);
$compileProvider.cssClassDirectivesEnabled(false);
}
最佳答案
自己解决了这个问题。此功能是在 1.6.0 中引入的,因此您需要升级才能利用这些方法。
关于javascript - 在 Angular 中将 commentDirectivesEnabled 和 cssClassDirectivesEnabled 设置为 false,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39897621/