2
I’m having a problem with the customization of a CSS, Angularjs does not allow me to write a code snippet as follows:
<style>
.btn-n {
min-height: {{botao.altura}}px;
min-width: {{botao.largura}}px;
border-radius: {{botao.cantos}}px;
font-family: {{botao.fonte}};
color: {{botao.corFonte}};
background-color: {{botao.corFundo}};
}
.btn-n .btn-texto {
font-size: {{botao.tamanhoFonte}}px;
}
#pagina-campanha .pagina-texto-inicial {
font-family: {{pagina.textoInicialFonte}};
font-size: {{pagina.textoInicialTamanhoFonte}}px;
color: {{pagina.textoInicialCorFonte}};
}
#pagina-campanha .pagina-texto-link {
font-family: {{pagina.textoLinkFonte}};
font-size: {{pagina.textoLinkTamanhoFonte}}px;
color: {{pagina.textoLinkCorFonte}};
}
#pagina-campanha .pagina-texto-final {
font-family: {{pagina.textoFinalFonte}};
font-size: {{pagina.textoFinalTamanhoFonte}}px;
color: {{pagina.textoFinalCorFonte}};
}
#pagina-campanha .pagina-texto-informativo {
font-family: {{pagina.textoInformativoFonte}};
font-size: {{pagina.textoInformativoTamanhoFonte}}px;
color: {{pagina.textoInformativoCorFonte}};
}
#pagina-campanha .btn-pagina {
font-family: {{pagina.botoesFonte}};
font-size: {{pagina.botoesTamanhoFonte}}px;
background-color: {{pagina.botoesCorFundo}};
border-color: {{pagina.botoesCorFundo}};
}
</style>
But in my application I need to apply these customizations as the user updates in a form. It’s very quiet to do with ng-style when you have three or four properties, but then it becomes a mess. Any suggestions?
You could instead of changing class attributes, you could change class. It would keep your code simpler and easier to read/edit.
– Hamurabi Araujo
Problem is that I have seven fixed classes, with about seven attributes with variable values.
– Matt S
Angularjs
runs on the client, to use something like this you would need to do on the server (.net, java, etc).Angularjs
that you can use is thengStyle
, that way<elemento ng-style="{ 'height': minhaaltura+ '%' }">
– Ricardo Pontual