Coder Social home page Coder Social logo

angular-toggle-switch's People

Contributors

arusanov avatar baptadn avatar brettahale avatar cdjackson avatar cgarvis avatar cstephens-cni avatar gotra avatar hypercubed avatar mmaestri avatar nmorse avatar paul-barry-cengage avatar paul-tst avatar tlvince avatar twalling avatar zachlysobey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-toggle-switch's Issues

toggle jumps back on android 4.3 and 4.2.2

I have the toggle switch working as expected im my browser and on android 4.4. However on a android 4.2.2 or 4.3 device the switch jumps back to its previous position right after it is switched. The only way to correctly switch the button is by holding it down a short time and then releasing it again.

Any idea what could cause this behaviour?

array format injection

controller: function($scope) {

would be better off as:

controller: ['$scope', function($scope) {

because uglification of javascript will break this library (and whatever project that uses it).

Travis CI build is only executing one test

https://travis-ci.org/cgarvis/angular-toggle-switch/builds/75115008

Firefox 31.0 (Linux): Executed 1 of 12

Running "karma:unit" (karma) task
Verifying property karma.unit exists in config...OK
File: [no files]
Options: background=false
INFO [karma]: Karma server started at http://localhost:8080/
INFO [launcher]: Starting browser Firefox
INFO [Firefox 31.0 (Linux)]: Connected on socket id cJRHDJXTObichwv3iADn
Firefox 31.0 (Linux): Executed 1 of 12
 SUCCESS (0.332 secs / 0.178 secs)
Done, without errors.

add to nuget

Similar to your Bower package would be great if you could add it to NuGet.

Unable to switch the toggle

Hi.

I'm unable to use this module. I get this error when I try to change the status of the switcher.

Error: [$compile:nonassign] Expression 'undefined' used with directive 'toggleSwitch' is non-assignable!

I included the angular-toggle-switch.js file and added the module to my app in this way.

var module = angular.module("app", ["ngRoute", "ngResource", "angularFileUpload", "ui.bootstrap", "ui.bootstrap.datetimepicker", "toggle-switch"]);

Where I'm wrong?

Please Tag current master

Hi. Is master stable ? It seems to work fine for me. There are no tagged versions that support ngModel yet, would be nice :)

Possible to change switch values?

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?

Unexpected behavior when on-label or off-label not include in tag (with angularjs 1.2.0-rc.2)

Perhaps it is a difference between angularjs 1.0 and 1.2 but I'm still getting blank labels if the on-label and off-label are not specified in the tag, Meaning $scope.offLabel and $scope.onLabel remain undefined even after the link function is called rather than using the defaults On and Off.

If you are really not going to use two-way binding shouldn't you remove the objects from the scope and use this instead:

      $scope.onLabel = attrs.onLabel || 'On';
      $scope.offLabel = attrs.offLabel || 'Off';

Like I said this may be a difference between 1.0 and 1.2.. or I could just be missing something.

API to Control Toggle Switch

Can I toggle the switch via a function call? In my case, a button is used to control all other button/value, so that when that master button is ON, all other button is ON and vice versa

Add support to icon labels

I changed the template to accept HTML code instead of text at the labels.
I would like to commit my changes.

NPM install causes warning: No repository field

running npm install causes the following warning

npm WARN package.json [email protected] No repository field

my package.json:

  "dependencies": {
    ...
    "angular-toggle-switch": "^1.3.0",
    ...
  }

I assume this is a simple fix of adding the github repo url to a repository field on your package.json?

Toggle Swipe

this toggle switch will support swipe function can you please give the example for this

Wrong model reference in the demo page

The property used in the directive is model not ng-model, so the examples in the demo page should be changed to:

<toggle-switch model="switchStatus"><toggle-switch>

Border radius from demo page

The border radius as displayed on the demo page does not appear to be in the angular-..-bootstrap.css file. Is this the intention?

Gap between toggle switch buttons and container

We're using angular for an android app. On my local, there is no gap. On my Samsung Galaxy S3, there is a 1px-3px gap between the toggle switch and container (see screenshots). I've tried 3 times to close the gap; As soon as I close one gap on the off button a gap will appear on the off button.

Attempt No 1

.toggle-switch .switch-off {
  left: -49%;
}

Attempt No 2

.toggle-switch .knob {
  border: none;
}

Attempt No 3

.toggle-switch .knob {
  border: none;
}

My current CSS:

     .toggle-switch {
    border: 2px solid #626262;
    float: right;
    }
    .toggle-switch span {
    height: 100%;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: normal;
    }
    .toggle-switch .switch-left {
    color: #fff;
    background: #33b5e5;
    text-transform: uppercase;
    }
    .toggle-switch .switch-right {
    color: #000;
    background: #1e6681;
    text-transform: uppercase;
    }

Any ideas on how to fix it so there's no gap on both buttons? Thanks.

galaxy-note3-screenshot-2
galaxy-note3-screenshot

Use animation only when user clicks

I am using the angular-toggle-switch in my application in a settings dialog. The user can select from a menu to go between panels. I have noticed that when a panel is shown with the toggle switch on it, and the initial value in ng-model is false, the toggle switch animates from on to off. Is it possible to make it so that it shows the "off" value without animation when it's a model change, and with animation when the user clicks to change it?

Please support minification

Minification with your code breaks everytihing. Solution: use this:

    controller: ['$scope', function($scope){
      $scope.toggle = function toggle() {
        if(!$scope.disabled) {
          $scope.model = !$scope.model;
        }
      };
    }],

Instead of:

    controller: function($scope) {
      $scope.toggle = function toggle() {
        if(!$scope.disabled) {
          $scope.model = !$scope.model;
        }
      };
    },

Thank You!

Knob Label issue

No knob label added, but one is added automatically:

HTML:
<toggle-switch ng-model="stat.show"><toggle-switch>

Inspector:
<span class="knob ng-binding" ng-bind="knobLabel">ร‚&nbsp;</span>

2015-05-21_1654

MIME type issue with demo

In Chrome:

Refused to execute script from 'https://raw.github.com/cgarvis/angular-toggle-switch/master/angular-toggle-switch.min.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. 

Disabled based on scope value

Why in your directive the attribute disabled is defined as a string? disabled="false" will disable the switch anyway. It's possible to achieve it with something like this:

 <toggle-switch disabled="{{ (isAdmin) ? '' : 'true' }}" ng-model="lock"></toggle-switch>

But your example with true leaves me thinking that the opposite is possible.

Maybe the local scope property should be = instead of @.

scope: {
    disabled: '=',
     ...
 },

This will give the possibility to disable the switch with a scope variable.

 <toggle-switch disabled="true" ng-model="lock"></toggle-switch>
 <toggle-switch disabled="false" ng-model="lock"></toggle-switch>
 <toggle-switch disabled="!isAdmin" ng-model="lock"></toggle-switch>

use of ng-model

Hi! thanks for the great widget :)
Any reason for using model instead of the native ng-model ?

on true or false value

Is it possible to get other value than true or false? for example
[ng-true-value=""]
[ng-false-value=""]

Add beforeToggle callback ?

Hi,
Would it be possible to add a callback before the switch is toggled ?
Currently, I load data via Ajax from a DB. There is an boolean attribute for each line of this data, which is the model for each toggle switch. My use case is :
When you click on the toggle, it updates the attribute in DB. My problem is that the toggle is switched before the ajax request is done. In case of a servor error, the toggle is switched let's say to "yes", the ajax return an error, the toggle is switched back to "no".

I'd like to wait for the ajax response before any switch happens. How would you do that ? Watching my data is not useful there.

Thanks.

Add Listener for changes

Would it be possible to add a listener for when the user toggles? This would allow much easier coding when nesting the switch inside of lists.

ng-class support?

I haven't been able to get ng-class to work with toggle-switch:

<toggle-switch ng-model="adminStatus" ng-class="{ 'switch-on' : true }" style="margin-bottom: 5px;" class="danger" on-label="Yes" off-label="No"><toggle-switch>

I get errors like:

Error: [$parse:syntax] Syntax Error: Token '{' is an unexpected token at column 24 of the expression [{ 'switch-on' : true } { 'disabled': disabled }] starting at [{ 'disabled': disabled }].

So it's clearly using ng-class to inject the { 'disabled': disabled } but I'm not sure how to add another ng-class expression in with it.

Any ideas?

Disabled with bind value

I need to disable or enable dynamically the toggle switch i tried to use the disabled attribute but it seems that is not working well.

Does not handle form.$pristine

When using angular toggle switch within a form the form's $pristine value is not properly updated.

Is this an angular toggle switch issues or maybe I'm doing something wrong?

Plunker

<form name="infoForm" class="form-horizontal" role="form">
      <toggle-switch model="myModel"></toggle-switch>
</form>

<p>Form Pristine:  {{infoForm.$pristine}}</p>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.