-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Replace: true doesn't keep attributes that have been set on the element in the compile fn #10465
Comments
Interesting. However, angular always sets the classes on the element that has ng-model. So the "bug" here ist that |
The plunkers are a simplification of some legacy code I was supporting. The developer had more logic in the directive's link function to basically have the ng-model on the label update the nested checkboxes and have the child checkboxes update the label as well. I wouldn't be opposed to this being filed as a won't fix as it isn't a very Angular way of doing things, but I wanted to file the issue just to document it in case anyone else runs into it. I just found it weird that it was still setting the ng-valid class, but not the pristine class, I would've thought it was an all or nothing thing. |
Okay, thanks. |
Note: since A fix would be to call $addClass on the |
Yeah, it's not a huge deal for me, the simplest work around for us was to just not use replace : true, because it's deprecated anyways. |
I'm not sure if this is a bug, or if I missed something in the release notes for upgrading to 1.3 .
Using replace:true on a directive with an input element such as a checkbox in Angular 1.2 sets the classes ng-valid and ng-pristine on the parent element.
However, in Angular 1.3.6, only the ng-valid class is being set on the parent element.
Reproducible: always
Browsers: Chrome 39, Firefox 34, and IE 10
Operating system: Windows 7
Plunkers Demonstrating the Difference in Behavior:
Angular 1.3.6 : http://plnkr.co/edit/VES7ZZXfqrpXU4gVwmYs?p=preview
Angular 1.2.9 : http://plnkr.co/edit/DPAfwHjGOfMw3grYiTxf?p=preview
The text was updated successfully, but these errors were encountered: