0

I have a problem with Parsley JS and interpolation of Angular2:

I need to pass an interpolation as value of the data-parsley-error-container.

Example:

<div class="input-group" id="{{id}}">
   <input type="number" id="service" [(ngModel)]="service" name="service" class="form-control" required="required" data-parsley-errors-container="{{id}}">
   <span class="input-group-addon">seconds</span>
</div>

I get the next error:

Error: Uncaught (in promise): Template parse errors: Can't bind to 'data-parsley-errors-container' since it isn't a known native property (" data-parsley-min="1" required="required" [ERROR ->] data-parsley-errors-container="{{id}}">

Do you have any idea or solution?

crissty
  • 1
  • 1

2 Answers2

0

Use property binding instead of interpolation:

[data-parsley-errors-container]="id"
Stefan Svrkota
  • 48,787
  • 9
  • 98
  • 87
0

For non-native attributes, just bind with [attr.x]:

[attr.data-parsley-errors-container]="id"
Maximilian Riegler
  • 22,720
  • 4
  • 62
  • 71