nz-toggle icon indicating copy to clipboard operation
nz-toggle copied to clipboard

Put label inside slider

Open hnguyenec opened this issue 9 years ago • 2 comments

Is it possible to configure Labels to show inside slider ?

hnguyenec avatar Aug 01 '16 03:08 hnguyenec

Currently no. But I would accept a pull request that supports that functionality On Sun, Jul 31, 2016 at 9:37 PM HUY NGUYEN [email protected] wrote:

Is it possible to configure Labels to show inside slider ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tannerlinsley/nz-toggle/issues/34, or mute the thread https://github.com/notifications/unsubscribe-auth/AFUmCcfwnnZ19fj70jOo0AQX36aRIKw-ks5qbWnjgaJpZM4JZN4e .

tannerlinsley avatar Aug 01 '16 04:08 tannerlinsley

I wanted to show the values of the toggle (in my case on / off) so in the directive template I changed:

<div class="nz-toggle-handle"></div>

to

<div class="nz-toggle-handle"><label ng-show="showLabels">{{ngModel}}</label></div>

then in function parseOptions() I added 'showLabels' to the attribute overrides.

and then I added

.nz-toggle-handle { text-align: center; } .nz-toggle-handle label { cursor: pointer; }

to my CSS.

You can now use it like this: <nz-toggle ng-model="myModel" show-labels="true" val-true="'ON'" val-false="'OFF'"></nz-toggle>

HTH

StylishFlash avatar Aug 19 '16 17:08 StylishFlash