Changing element styles programmatically

I’m trying to change the style of the element every time the user accesses a new page without having to change the .toolbar-background styling. Is ther a way to programmatically style elements?

1 Like

write a custom directive for that or use the built in stuff of Angular2:
https://angular.io/docs/ts/latest/api/common/index/NgStyle-directive.html
https://angular.io/docs/ts/latest/api/common/index/NgClass-directive.html

or take advantage of the dom-properties:

<ANY [style.color]="fontColor"></ANY>
<ANY [style.backgroundColor]="backgroundColor"></ANY>

I tried using those but I had no success.

Have you found any solution?

What have you tried so far? Please provide some code :slight_smile: