简体   繁体   English

AngularJS:md-button //我可以通过ng-click在ng-button中使用2行和2种字体大小吗?

[英]AngularJS : md-button // Can I have 2 lines, and 2 font sizes in an ng-button, with an ng-click?

I would like a button (in NodeRed, using the ui template), with inside the button, a heading in say font 10, then on a break, and a value with larger font size, but still in the button? 我想要一个按钮(在NodeRed中,使用ui模板),在按钮内部,标题为10号字体,然后中断,并使用较大字体的值,但仍在按钮中?

From what I can see I can only declare text size once for one button, is their any way? 从我看到的内容中,我只能为一个按钮声明一次文本大小,这是怎么回事?

Thank you smooth_atonal_sound ! 谢谢smooth_atonal_sound! I am now almost there, stil need help with ng-click, see the code below (adapted from Scargill), the ng-click directive does not work, how can I fix that? 我现在快到了,需要ng-click的帮助,请参见下面的代码(改编自Scargill),ng-click指令不起作用,如何解决?

 <style> .filled { height: 100% !important; padding: 0 !important; margin: 0 !important; } .nr-dashboard-template { padding: 0; margin: 0; overflow-x: hidden; overflow-y: hidden; } .rounded { border-radius: 7% 7% 7% 7%; } .fontbig { font-size: 28px; } .fontsmall { font-size: 14px; } .tolowercase { text-transform: lowercase; } .tocapitalize { text-transform: capitalize; } .backgroundgreen {background: #73AD21;} </style> <script> $('.vibrate').on('click', function() { navigator.vibrate(100); }); function restore_bg(x,y) { $(this).css("background-color", x); }; $('.touched').on('mousedown', function() { var x= $(this).css("background-color"); // $(this).css("background-color", "yellow"); navigator.vibrate(80); }); </script> <md-button class="alerted filled touched rounded tocapitalize vibrate"> <span style="fontsmall" {{msg.topic}}> <br><br> <span style="fontbig"{{msg.val}}> <ng-click="send({payload: 'test it...'})" > </md-button> 

Yes you can. 是的你可以。 You can style it like you would any other element. 您可以像设置其他任何元素一样设置样式。

`<md-button>
    <span class="size-1">Primary Size</p>
    <span class="size-2">Secondary Size</p>
</md-button>`

`.size-1 {
    font-size: 10px;
}
.size-2 {
    font-size: 12px;
}`

Here is a working version, sort-of: 这是一个工作版本,排序方式:

<md-button 
   class="alerted filled touched rounded tocapitalize vibrate"
   style="background-size: 100% 100%; background-repeat: no-repeat;"
   ng-click="send({payload: 'Red Button'})">
   <span class="fontsmall" >{{msg.topic}}</span><br><br>
   <span class="fontbig">{{msg.val}}</span>
</md-button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM