angular使用什么样的样式,如何在Angular中的CSS中添加其他样式属性?

I have a property which should set the font size of a text element. I've tried this so far:

placeholder="Enter your TAX ID"

id="tax"

[(ngModel)]="tax_out"

[(ngModel)]="tax_in"

style="width: 100%; height: 100%; position: relative; bottom: 0px; fontsize: {{fontsize}}">

Unfortunately without success.

I get this in logcat:

"WARNING: sanitizing unsafe style value width: 100%; height: 100%;

position: relative; bottom: 0px; fontsize: (see

http://g.co/ng/security#xss)."

"[WARN] TypeError: Cannot set property style of [object Object] which

has only a getter"

"ERROR", source: ng:///AppModule/ModalContentPage.ngfactory.js (154)

"ERROR CONTEXT", source: ng:///AppModule/ModalContentPage.ngfactory.js (154)

解决方案

If it's just a single style, you can use property binding for this:

Please take a look at the ngStyle docs for more info if you need to set more than one style dynamically:

...

...

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值