Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-change adds parenthesis #10

Open
dhaub opened this issue Mar 28, 2015 · 1 comment
Open

ng-change adds parenthesis #10

dhaub opened this issue Mar 28, 2015 · 1 comment

Comments

@dhaub
Copy link

dhaub commented Mar 28, 2015

Remove the () that are added on ng-change in line 12. Change

  html +=   attrs.ngModel ? ' ng-click="' + attrs.ngModel + '=!' + attrs.ngModel + (attrs.ngChange ? '; ' + attrs.ngChange + '()"' : '"') : '';

to

  html +=   attrs.ngModel ? ' ng-click="' + attrs.ngModel + '=!' + attrs.ngModel + (attrs.ngChange ? '; ' + attrs.ngChange + '"' : '"') : '';

This causes problems when the supplied ng-change is actually a function with supplied parameters. This problem came up when using the switch inside an ng-repeat section. The function supplied to ng-change needed to have a parameter with the specific item.

<div ng-repeat="item in items">
  <switch name="isActive" ng-model="item.isActive" class="green" ng-change="activate(item);"></switch>
</div>

Awesome control. Thanks for putting it together.

@Stupidism
Copy link

meet this bug today

Tyrion85 added a commit to Tyrion85/angular-ui-switch that referenced this issue Jan 17, 2017
…uld be backward compatibile - for settings without brackets, they should still be inserted automatically. This solves the issue xpepermint#10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants