私のAngular 2アプリでは、あるコンポーネントから別のコンポーネントに配列を渡す必要があります。次のように私は、この値を読む必要がInputModuleComponent
という名前のコンポーネントで例外self.context.XXX.subscribeは関数ではありません
@Component({
selector: "system-dynamics",
templateUrl: "/app/component/main/template/system-dynamics.html"
})
export class SystemDynamicsComponent implements OnInit {
private dialogDisplayed: boolean = false;
@Output() sdFactors: any[] = [];
:
テンプレート:
<system-dynamics (sdFactors)="this.sdFactors"></system-dynamics>
はコンポーネント:
私は1つのアレイ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