angular - buton on-off în angular2 folosind Typescript


Folosesc angular2 cu typescript.
Cum pot să creez un buton pornit - oprit?

Răspuns #1

Da, pentru tine aici este un Switch stilat (comutator pornit/oprit) folosind tema Bootflat (am folosit tema Bootflat pentru stilizare, vezi aici). Doar pune acest cod ca HTML și trebuie să adaugi câteva stiluri.

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

iată codul pentru 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>