'I have input fields which have Dynamic data I want to do validation for it using custom validation. How to do that?
This is the content for which, I have to do custom validation. In this code, I have to use custom validation. If I used formControlName it not take data dynamically.
<p-organizationChart [value]="data">
<ng-template let-node pTemplate="custom">
<div class="node-component">
<div class="node-header p-corner-top">
<input [(ngModel)]="node.text.name" required />
</div>
<textarea
[(ngModel)]="node.text.desc"
placeholder="Enter description..."
required
></textarea>
<!-- <span
*ngIf="
inputValues.controls.desc.dirty || inputValues.controls.desc.valid
"
>This is error</span
> -->
<div class="button-panel">
<button class="button button-add" (click)="addNode(node)">
<span class="pi pi-plus"></span>
</button>
<!-- <button class="button" (click)="addNode(node)">Add</button> -->
<button
class="button button-remove"
(click)="deleteNode(node)"
*ngIf="node.parent != undefined"
>
<span class="pi pi-trash"></span>
</button>
</div>
</div>
</ng-template>
</p-organizationChart>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
