내 Angular 2 앱에서 한 구성 요소의 배열을 다른 구성 요소로 전달해야합니다.예외 self.context.XXX.subscribe는 함수가 아닙니다
템플릿 :
<system-dynamics (sdFactors)="this.sdFactors"></system-dynamics>
구성 요소 :
를 나는 다음과 같이이 값을 읽을 필요가InputModuleComponent
라는 이름의 구성 요소에
@Component({
selector: "system-dynamics",
templateUrl: "/app/component/main/template/system-dynamics.html"
})
export class SystemDynamicsComponent implements OnInit {
private dialogDisplayed: boolean = false;
@Output() sdFactors: any[] = [];
: 나는 하나 개의 배열 sdFactors
를 노출 SystemDynamicsComponent
라는 구성 요소가
export class InputModuleComponent implements OnInit {
...
sdFactors: any[] = [];
입력 모듈 구성 요소를 실행하면 각도에서이 오류 메시지가 표시됩니다. TypeError: self.context.sdFactors.subscribe is not a function at Wrapper_SystemDynamicsComponent.subscribe (wrapper.ngfactory.js:38) at View_InputModuleComponent6.createInternal (component.ngfactory.js:3103) at View_InputModuleComponent6.AppView.create (core.umd.js:12262) at View_InputModuleComponent6.DebugAppView.create (core.umd.js:12666) at TemplateRef_.createEmbeddedView (core.umd.js:9320) at ViewContainerRef_.createEmbeddedView (core.umd.js:9552)
내가 누락 된 아이디어가 있습니까?
당신이 제안한 (' system-dynamics>)처럼 변경했지만 문제는 남아 있습니다. –
Emdee
내 업데이트 –
을 참조하십시오. 내가 제안한대로'@ Input'을 사용합니다. – Emdee