Angular 是否有一个相当于$parent的角度?

Angular 是否有一个相当于$parent的角度?,angular,ngfor,Angular,Ngfor,在angularJS中,在ng repeat中,我们可以使用$parent访问数据。角7中是否有等效项?下面是场景 我的模型课:- export class Question { Sections : Array<Section>; IsArchived : boolean; } export class Section{ Name : string; } 导出类问题{ 部分:阵列; IsArchived:布尔型; } 出口类别组{ 名称:字符串; } HTML:-

在angularJS中,在ng repeat中,我们可以使用$parent访问数据。角7中是否有等效项?下面是场景

我的模型课:-

export class Question {
  Sections : Array<Section>;
  IsArchived : boolean;
}

export class Section{
  Name : string;
}
导出类问题{
部分:阵列;
IsArchived:布尔型;
}
出口类别组{
名称:字符串;
}
HTML:-

<div *ngFor="let section of Question.Sections">
  {{section.Name}}
  <!--Want to access parent here-->
  <span *ngIf="$parent.IsArchived"> This is archived</span>
</div>

{{section.Name}}
这是存档的

angularjs中的$parent没有与angularjs中的$parent等效的值,但是您只需在ngFor中使用父对象即可

<div *ngFor="let section of Question.Sections">
  {{section.Name}}
  <span *ngIf="Question.IsArchived"> This is archived</span>
</div>

{{section.Name}}
这是存档的

你能告诉我你想在Angular 7中实现什么吗?