Something went wrong. Try again.
Some angular code i wrote while following: Angular - The Complete Guide (2025 Edition)
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142import { Component } from '@angular/core';import { AbstractControl, FormControl, FormGroup, ReactiveFormsModule, Validators,} from '@angular/forms';
function mustContainQuestionMark(control: AbstractControl) { if (control.value.includes('?')) { return null; } return { doesNotContainMark: true };}
@Component({ selector: 'app-login', standalone: true, templateUrl: './login.component.html', styleUrl: './login.component.css', imports: [ReactiveFormsModule],})export class LoginComponent { form = new FormGroup({ email: new FormControl('', { validators: [Validators.email, Validators.required], }), password: new FormControl('', { validators: [ Validators.required, Validators.minLength(6), mustContainQuestionMark, ], }), });
onSubmit() { console.log(this.form); }}