export class RepeatPasswordDirective implements Validator,OnChanges {
/ * *
- check method
- @ param c
- @ returns {{[p: string]: any}}
* /
validate (c: AbstractControl): {[p: string]: any} {
return verifyPassword(c,this.repeatPassword.control);
}
ngOnChanges (changes: SimpleChanges): void {
this.repeatPassword=changes["repeatPassword"].currentValue;
}
/ *
- pass in the model of another input tag through the attribute The
- name is the same as the selector, so there is no need to add additional attributes to pass in when using it.
* /
@ Input () repeatPassword:NgModel;
constructor () {}
}
< hr > validate (c: AbstractControl): {[p:string]: any} {
}
like this function, the return value is {[p:string]: any}. What does it mean to put a key-value pair in square brackets?