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

form select - angular validation classes not being propagated to the parent div #415

Open
will7742 opened this issue Mar 14, 2018 · 0 comments

Comments

@will7742
Copy link

will7742 commented Mar 14, 2018

In angular 5 I'm using a custom validator that sets the select box formControl to invalid on form-load. If I select something in the select box, it properly sets the Select's class to ng-valid, but not it's parent div. This propagation is important since the select is set to hidden, I need the parent div to be accurate in order to style invalid fields. It also seems that ng-dirty is not being propagated up either.

Example Dom after I select an element:

<div class="select-wrapper initialized ng-untouched ng-pristine ng-invalid">
  <span class="caret">▼</span>
  <input type="text" class="select-dropdown" readonly="true" data-activates="select-options-537deb8c-44f8-d56b-52e0-ddd06e4d2186" value="Workflow A">
  <ul id="select-options-537deb8c-44f8-d56b-52e0-ddd06e4d2186" class="dropdown-content select-dropdown ">
    <li class=""><span>Workflow A</span></li>
    <li class=""><span>Workflow B</span></li>
  </ul>
  <select _ngcontent-c10="" formcontrolname="workflowId" id="workflowId" materialize="material_select" ng-reflect-name="workflowId" class="initialized ng-untouched ng-dirty ng-valid" ng-reflect-materialize="material_select" ng-reflect-materialize-select-options="[object Object]">
    <!--bindings={
    "ng-reflect-ng-for-of": "[object Object],[object Object"
     }-->
    <option _ngcontent-c10="" value="4" ng-reflect-value="4">Workflow A</option>
    <option _ngcontent-c10="" value="5" ng-reflect-value="5">Workflow B</option>
  </select>
</div>
@will7742 will7742 changed the title form select - validations not being propagated correctly all the time to the parent div form select - angular validation classes not being propagated correctly to the parent div Mar 14, 2018
@will7742 will7742 changed the title form select - angular validation classes not being propagated correctly to the parent div form select - angular validation classes not being propagated to the parent div Mar 14, 2018
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

1 participant