I don't quite understand the writing of those functions in angular. Please mention it.

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?


this is typescript syntax

add : after the function parentheses to indicate the function return type

here means that the type of the returned value is a JSON object, the key of the JSON object is a value of any string type, value can be of any type, any .


specifies that the return value is an object,
key is of type string and can be any string value.
value is any type of any.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2bb24-4d154.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2bb24-4d154.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?