47
rated 0 times
[
53]
[
6]
/ answers: 1 / hits: 44261
/ 9 Years ago, sun, august 30, 2015, 12:00:00
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?
More From » angular