This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Description
https://angular.io/docs/ts/latest/guide/template-syntax.html#!#ngStyle
setStyles() {
let styles = {
// CSS property names
'font-style': this.canSave ? 'italic' : 'normal', // italic
'font-weight': !this.isUnchanged ? 'bold' : 'normal', // normal
'font-size': this.isSpecial ? '24px' : '8px', // 24px
};
return styles;
}
should IMHO be considered as DON'T example
-
It binds a method in the view [ngClass]="setClasses()" which is discouraged and should be avoided except one knows what she's doing
-
It returns a new instance for every call. If it would at least cache the result in an instance field and return that as long as not dependencies are changed, it would be ok.