Skip to content

Instantly share code, notes, and snippets.

View sannonaragao's full-sized avatar

Sannon Aragão sannonaragao

View GitHub Profile
@sannonaragao
sannonaragao / About-the-input-validation-component.txt
Last active April 5, 2024 15:29
An input validation message to use with PrimeNG
It's a component to validate required fields, minimun length, patterns and custom validations.
Example 1 : Validate: required, minlength and a pattern.
some.component.html
<input pInputText type="text" name="email" [(ngModel)]="user.email"
ngModel #email="ngModel" required minlength="5"
pattern="^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$">
<app-input-validation [control]="email"
@sannonaragao
sannonaragao / About-the-notification-component.txt
Last active March 4, 2022 11:13
Use PrimeNG Message and Growl as a global service of the application.
PrimeNG has 2 different components to display messages:
The Messages component: https://www.primefaces.org/primeng/#/messages
The Growl component: https://www.primefaces.org/primeng/#/growl
notifications.component.ts - is the notification component with both growl and services from PrimeNg:
<p-growl [value]="growl"></p-growl>
<p-messages [value]="message"></p-messages>
notifications.service.ts - is the service to be used to send messages do Growl and Messages.