2
에 angular-material
을 사용하고 있습니다. 첫 번째 구성 요소에 config()를 설정 한 후 다른 구성 요소로 전달하여 속성을 읽을 수 있도록하고 싶습니다. 에서dialofRef를 사용하여 각도 4의 구성 요소간에 구성을 전달하십시오.
내 (news-feed.component.ts
) 나는이 기능을 가지고 :
editPost(id,item) {
const config = new MatDialogConfig();
config.id = id;
config.data = item;
const dialogRef: MatDialogRef<PostComponent> = this.dialog.open(PostComponent, config);
dialogRef.componentInstance.editedPost(config);
}
와의
내 (post.component.ts
) :
editedPost(config) {
console.log(config.data);
}
내 데이터는 (das) 단어입니다. 즉, '데이터'속성을 읽을 수 있다는 의미이며, 아무 키나 누르면 오류가 반복됩니다. 이자형. 내가 여기에서 놓친 것은 무엇입니까?
당신은 올바른으로 답변을 표시해야합니다. – Kpfromer
@Kpfromer 친애하는 Kpfromer, 나는 그것을 안다. 그러나 나는 내일까지 나의 대답을 표시 할 수 없다. 친애하는 –