Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

Image Before Validation

Form After Validation

Image After Validation

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
416 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...