Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Part 11 Angular Tutorial | Form validations | Custom Form Validations | Services in Angular

  • Trinits Technologies
  • 2023-03-08
  • 72
Part 11 Angular Tutorial | Form validations | Custom Form Validations | Services in Angular
trinitstrinits techangularangular 12angular 14components in angularangular tutorialservices in angularvalidationsform validations in angularcustom validationscustom angular validations
  • ok logo

Скачать Part 11 Angular Tutorial | Form validations | Custom Form Validations | Services in Angular бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Part 11 Angular Tutorial | Form validations | Custom Form Validations | Services in Angular или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Part 11 Angular Tutorial | Form validations | Custom Form Validations | Services in Angular бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Part 11 Angular Tutorial | Form validations | Custom Form Validations | Services in Angular

Custom validations and Services in Angular

Custom validators allow you to implement your own validation logic and extend the built-in validators provided by Angular.

Here's an example of how to create a custom validator in Angular:
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';

export function forbiddenNameValidator(forbiddenName: RegExp): ValidatorFn {
...
}

In this example, we define a forbiddenNameValidator function that takes a regular expression as an argument and returns a ValidatorFn. The ValidatorFn takes an AbstractControl as an argument and returns a ValidationErrors object if the control fails validation, or null if it passes validation.

The validator checks if the control's value matches the regular expression provided as an argument. If the value matches the regular expression, the validator returns a ValidationErrors object with a forbiddenName key and the value of the control, indicating that the control failed validation. If the value does not match the regular expression, the validator returns null, indicating that the control passed validation.

In this example, we import the forbiddenNameValidator and use it to add a custom validator to the name control. We pass a regular expression that matches the string 'admin' as an argument to the validator.

In the template, we use the *ngIf directive to show an error message if the name control fails validation. We check if the control has an error with the key forbiddenName and display a message indicating that the value is not allowed.

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]