Change button colour based on value from database
I can set the button text from my db and wondered if it would be possible to set the button colour in the same way?
Catch up wih the Appery.io community on our forum. Here you'll find information on the lastest questions and issues Appery.io developers are discussing.
https://forum.appery.io/
I can set the button text from my db and wondered if it would be possible to set the button colour in the same way?
Hello Tony,
For the AngularJS apps:
1) get the values from DB
2) apply certain class (previously defined in css) using ng-class
https://scotch.io/tutorials/the-many-...
ng-class -- color-for-{{valueFromDB}}
in CSS
.color-for-value1 { ..styling }
.color-fro-value2 { ..styling }
etc.
For the JQM apps:
1) please add JS to the button's mapping:
$(element).addClass("color-for-" + value);
Thanks Sergiy,
I'll try it with jquery and let you know,