MattDionis MattDionis - 19 days ago 23
AngularJS Question

Set commentDirectivesEnabled and cssClassDirectivesEnabled to false in Angular

I'm attempting to make some small tweaks to my config to hopefully improve performance slightly. I read through the Angular docs here and they mention disabling comment and CSS class directives. I tried to do so with the below code in my config, but I keep getting

TypeError: $compileProvider.commentDirectivesEnabled is not a function
or
TypeError: $compileProvider.cssClassDirectivesEnabled is not a function
errors.

Note: I'm running 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);
}

Answer

Solved this myself. This functionality was introduced post 1.4.9 so I will need to upgrade to take advantage of it.