this is my Component template.
<div [formGroup]="form" class="form-group">
<label [attr.for]="field.name" class="{{field.name}}Label form-control-label">{{field.label}}</label>
<input [formControlName]="field.name" [id]="field.name" class="form-control {{field.name}}Control">
<small id="{{field.name}}Help" class="form-text"></small>
</div>
After a validation process, is necessary add text-danger
(CSS class) to Label, using Renderer2 Class
(from Angular4)
const label = this.Render.selectRootElement('label[for="' + key + '"]');
this.Render.addClass(label, 'text-danger');
.addClass
method, works fine with input and helper text (below input). But in label tags, this method DELETE my LABEL Text
.
This is a bug? @angular 4.3.6
Form Before Validation
Form After Validation