![](/img/trans.png)
[英]Angular : Updating property of passed object in child component updates parent component, updating its value doesn't, why?
[英]Why not get the value passed from the parent component to the child component correctly?
我需要通過輸入將一個變量值從父組件傳遞給子組件。 也就是通過上面的ng-container
接收到的screenMode
值需要交給add-user子組件。
<ng-container *ngIf="screenMode == screenStateEnum.ADD_USER || screenMode == screenStateEnum.EDIT_USER">
<add-user [screenMode] = "screenMode" [userId]="selectedRow?.userId" (goToUsers)="refresh()"></add-user>
</ng-container>
在 add-user.component 中有@Input() screenMode: string;
但是這個輸入總是為 EDIT_USER 返回 0,為 ADD_USER 返回 1。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.