Notice: file_put_contents(): Write of 16795 bytes failed with errno=28 No space left on device in /var/www/tgoop/post.php on line 50
Frontender Libs - обзор библиотек JS / CSS@sWebDev P.3379
SWEBDEV Telegram 3379
Реактивные формы с AbstractControl в Angular

AbstractControl — это базовый класс для всех контролов. Он предоставляет методы и свойства, которые позволяют управлять состоянием, валидацией и зависимостями полей формы.

Пример:
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

constructor(private fb: FormBuilder) {}

ngOnInit() {
this.form = this.fb.group({
password: ['', Validators.required],
confirmPassword: ['']
});
this.form.get('confirmPassword')?.setValidators([
this.matchPasswordsValidator(this.form.get('password'))
]);
}
matchPasswordsValidator(passwordControl: AbstractControl | null) {
return (confirmPasswordControl: AbstractControl) => {
const password = passwordControl?.value;
const confirmPassword = confirmPasswordControl.value;

return password === confirmPassword ? null : { passwordMismatch: true };
};
}

В этом примере валидатор сравнивает значения password и confirmPassword, автоматически реагируя на изменения первого поля.

👉 @sWebDev
👍5



tgoop.com/sWebDev/3379
Create:
Last Update:

Реактивные формы с AbstractControl в Angular

AbstractControl — это базовый класс для всех контролов. Он предоставляет методы и свойства, которые позволяют управлять состоянием, валидацией и зависимостями полей формы.

Пример:

import { FormBuilder, FormGroup, Validators } from '@angular/forms';

constructor(private fb: FormBuilder) {}

ngOnInit() {
this.form = this.fb.group({
password: ['', Validators.required],
confirmPassword: ['']
});
this.form.get('confirmPassword')?.setValidators([
this.matchPasswordsValidator(this.form.get('password'))
]);
}
matchPasswordsValidator(passwordControl: AbstractControl | null) {
return (confirmPasswordControl: AbstractControl) => {
const password = passwordControl?.value;
const confirmPassword = confirmPasswordControl.value;

return password === confirmPassword ? null : { passwordMismatch: true };
};
}

В этом примере валидатор сравнивает значения password и confirmPassword, автоматически реагируя на изменения первого поля.

👉 @sWebDev

BY Frontender Libs - обзор библиотек JS / CSS




Share with your friend now:
tgoop.com/sWebDev/3379

View MORE
Open in Telegram


Telegram News

Date: |

In handing down the sentence yesterday, deputy judge Peter Hui Shiu-keung of the district court said that even if Ng did not post the messages, he cannot shirk responsibility as the owner and administrator of such a big group for allowing these messages that incite illegal behaviors to exist. Ng, who had pleaded not guilty to all charges, had been detained for more than 20 months. His channel was said to have contained around 120 messages and photos that incited others to vandalise pro-government shops and commit criminal damage targeting police stations. Telegram message that reads: "Bear Market Screaming Therapy Group. You are only allowed to send screaming voice notes. Everything else = BAN. Text pics, videos, stickers, gif = BAN. Anything other than screaming = BAN. You think you are smart = BAN. A Telegram channel is used for various purposes, from sharing helpful content to implementing a business strategy. In addition, you can use your channel to build and improve your company image, boost your sales, make profits, enhance customer loyalty, and more. Members can post their voice notes of themselves screaming. Interestingly, the group doesn’t allow to post anything else which might lead to an instant ban. As of now, there are more than 330 members in the group.
from us


Telegram Frontender Libs - обзор библиотек JS / CSS
FROM American