I am building an Angular 2.0 component and I want to control it's style dynamically (using ng-style
). After a quick view on Angular 2's docs i tried this:
<div class="theme-preview" ng-style="{'font-size': fontSize}">
{{fontSize}}
</div>
And saw that the size is actually printed inside the div but did not affected the style. fontSize
is one of component's property bindings', meaning the component gets it from its parent like this:
<my-component [font-size]="size" />
While inside the component I have:
@Component({
selector: 'XXX',
properties: ['fontSize']
})
Am I missing something here?