我正在从事Metronic Theme 的 Angular 6项目。它有以下代码。你能告诉我什么是[(action)]="action"
. 我知道如何绑定到输入元数据(即@Input()
)。我们通常这样做
<m-login *ngIf="action === 'login'" [action]="action"></m-login>
但这里不一样。这就像 2-way 模型绑定。但我们通常为此使用这种语法[(ngModel)]="model"
。有什么线索吗?
auth.component.html
<m-login *ngIf="action === 'login'" [(action)]="action"></m-login>
登录.ts
export class LoginComponent implements OnInit, OnDestroy {
@Output() actionChange = new Subject<string>();
@Input() action: string;
}