material icon indicating copy to clipboard operation
material copied to clipboard

md-switch: Does not initial on the "true" value when class attribute has a data binding

Open bdwade100 opened this issue 9 years ago • 1 comments

Actual Behavior:

  • What is the issue? *: When initializing an md-switch with (1) a class attribute that has a data binding and a (2) ng-model with an initial value of "true", the md-switch will not initialize to the "on" position.
  • What is the expected behavior?: The md-switch will initialize to the "on" position.

CodePen (or steps to reproduce the issue): *

  • CodePen Demo which shows your issue: https://codepen.io/bdwade/pen/eRWJae/
  • Details: When loading the CodePen, the initial state of the md-switch should be "on". If you click it once, it will switch it "off". Clicking it again will correctly switch it "on".

AngularJS Versions: *

  • AngularJS Version: 1.5.8 and 1.6.4
  • AngularJS Material Version: 1.1.3 and 1.1.4

Additional Information:

  • Browser Type: * Chrome
  • Browser Version: * 59.0.3071.86 (Official Build) (64-bit)
  • OS: * Windows 7 x64 SP1
  • Stack Traces:

Shortcut to create a new CodePen Demo. Note: * indicates required information. Without this information, your issue may be auto-closed.

Do not modify the titles or questions. Simply add your responses to the ends of the questions. Add more lines if needed.

bdwade100 avatar Jun 20 '17 18:06 bdwade100

My mistake: I need to use an "ng-class" attribute rather than a "class" attribute.

Fixed in CodePen.

Closing.

bdwade100 avatar Jun 20 '17 19:06 bdwade100