C
C
Cach2017-08-21 12:32:36
css
Cach, 2017-08-21 12:32:36

Dynamic styles in Angular 2?

Good afternoon. The essence of the problem: you need to change the styles for the entire project (background, color of buttons, fonts, etc.), which are pulled from the database. How to add such styles to the component's metadata? Only dynamic component generation?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
denismaster, 2017-08-21
@denismaster

You can write a directive that will take an object with a style description as input, and at the output will set the style of the element to which it is attached.

A
Alexander Moskalenko, 2017-08-21
@Alexinger

In the body add a class that will set the styles for the entire page.

F
furrya_black, 2017-08-28
@furrya_black

Horror what. I understand that your user interface can be customized? And the customization data - the colors of the buttons, etc. is put into the database on the server side?
This is actually the side of the front, to store customization data, use the local store, localforage to help. And untie nafik from remote storage in the database))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question