angular2 上的开关按钮使用 Typescript

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35453788/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 03:17:22  来源:igfitidea点击:

on-off button on angular2 using Typescript

typescriptangular

提问by user2247651

I am using angular2with typescript.
How can I create an on - offbutton?.

我使用angular2typescript
如何创建on - off按钮?

回答by Pardeep Jain

Yes for you here is a stylish Switch (on/off toggle) using Bootflat theme (i have used Bootflat theme for styling refer here). Just Put this code as HTMLand some styles you have to add.

是的,这里是使用 Bootflat 主题的时尚 Switch(开/关切换)(我使用 Bootflat 主题进行样式设计,请参阅此处)。只需将此代码作为HTML您必须添加的一些样式即可。

http://plnkr.co/edit/BoiiICbQLKBtePJlsfHZ?p=preview

http://plnkr.co/edit/BoiiICbQLKBtePJlsfHZ?p=preview

here is Code for Switch:

这是开关代码:

<label class="toggle col-sm-8">
  <input type="checkbox"(click)="Existing()">
  <span class="handle" style="top:0 !important"></span>
</label>

<h2 class='bg-danger'>Your Switch value Is  : {{value}}</h2>