We are making an Angular2 application and we want to be able to somehow create a global CSS variable (and update the properties\' values whenever changed wh
I did this plunker to explore one way to do what you want.
Here I get mystyle from the parent component but you can get it from a service.
import {Component, View} from 'angular2/angular2'
@Component({
selector: '[my-person]',
inputs: [
'name',
'mystyle: customstyle'
],
host: {
'[style.backgroundColor]': 'mystyle.backgroundColor'
}
})
@View({
template: `My Person Component: {{ name }}`
})
export class Person {}