Angular Built-in Directives are not working(ngClass, ngStyle, ngIf)
问题 I am following Template syntax section for the application of built-in attribute and structural directives from here https://v4.angular.io/guide/template-syntax#ngclass currentClasses: {}; setCurrentClasses() { // CSS classes: added/removed per current state of component properties this.currentClasses = { 'saveable': this.canSave, 'modified': !this.isUnchanged, 'special': this.isSpecial }; } I add currentClasses to my html as per Angular documentation above: <div [ngClass]="currentClasses"