Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Possible to change switch values? #76

Open
rbarman opened this issue Sep 27, 2015 · 4 comments
Open

Possible to change switch values? #76

rbarman opened this issue Sep 27, 2015 · 4 comments

Comments

@rbarman
Copy link

rbarman commented Sep 27, 2015

Currently it seems that the possible switch values are true and false.
Is it possible to add our own values that are more appropriate to our application?

Below is an example of what would be useful. Note the on-value and off-value fields.

        <toggle-switch
            ng-model="ctrl.model.side"
            on-label="For"
            on-value = "For"
            off-label="Against"
            of-value = "Against">
        <toggle-switch>

So in this case, the value for the 'On' case is "For" rather than true.
Ideally it would be nice to modify the default values for our own applications. Is there a way to do this?

@cgarvis
Copy link
Owner

cgarvis commented Sep 28, 2015

If it's something you would use so much that a global config makes sense for you, why not wrap this into your own directive?

<for-against-toggle-switch ng-model="ctrl.model.side" />

@zachlysobey
Copy link
Contributor

I too think this would be a very useful enhancement. Personally I don't know if my angular chops are good enough that I could successfully wrap in my own directive without a $watch function for each instance.

@sean-hill
Copy link

I agree, I'm converting my checkboxes in my app to this toggle and on one of them I have ng-true-value="false" ng-false-value="true" for a specific case.

@sean-hill
Copy link

Just made a pull request here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants