I have a question is it possible to declare comment inside of ng-class
ng-class="{'test':true,'test1':true, //some comment 'test2':true}"
It doesn't appear to. You would have needed to use the multiline comment syntax like so:
<div ng-class="{'test':true,'test1':true, /* some comment */ 'test2':true}"></div>
But that throws an error:
Syntax Error: Token '*' is unexpected, expecting [:] at column 29 of the expression [{'test':true,'test1':true, /* some comment */ 'test2':true}] starting at [* some comment */ 'test2':true}].
However you can work around this by declaring your styles in your controller/directive:
$scope.styles = {
'test': true,
'test1': true,
/* some comment */ 'test2': true
};
And including that in your view:
<div ng-app="MyApp">
<div ng-controller="MyCtrl">
<div ng-class="styles"></div>
</div>
</div>
jsFiddle Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With