在Angular中将commentDirectivesEnabled和cssClassDirectivesEnabled设置为false

Mat*_*nis 4 javascript angularjs

我试图对我的配置做一些小调整,希望能稍微提高性能.我在这里阅读了Angular文档,他们提到了禁用注释和CSS类指令.我尝试使用我的配置中的以下代码执行此操作,但我一直得到TypeError: $compileProvider.commentDirectivesEnabled is not a functionTypeError: $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);
}
Run Code Online (Sandbox Code Playgroud)

Mat*_*nis 7

自己解决了这个问题.此功能在1.6.0中引入,因此您需要升级才能利用这些方法.