Порядок оценки входных свойств - PullRequest
0 голосов
/ 19 апреля 2019

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

Например:

/**
 * converts row data into FormGroup using the function provided by the parent component
 * https://stackoverflow.com/a/54169646/174390
 */
@Input() getFormGroup: (row: any) => FormGroup;

/**
 * input row data
 */
@Input() set row(row: any) {
    this._row = row;
    this.updateRowForm(this._row);
}

updateRowForm(row: any) {
    // if getFormGroup input property comes after the row input property 
    // the getFormGroup will be undefined here, 
    // otherwise it will be initialized and the following call will succeed
    this.rowFormGroup = this.getFormGroup(row);
}
...