Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
angular 2如何绑定两个组件行为_Angular_Typescript - Fatal编程技术网

angular 2如何绑定两个组件行为

angular 2如何绑定两个组件行为,angular,typescript,Angular,Typescript,我有两个相等的分量 <component><component> <component><component> 我需要的是,如果其中一个改变了,另一个也改变了,例如,如果我有一个函数,当我点击元素时,写“hello”,如果我在其中一个元素中这样做,它将反映在两个组件中,我如何实现这一点 提前谢谢 <component #c1 (click)="c2.title = 'hello'"><component> <

我有两个相等的分量

<component><component>

<component><component>

我需要的是,如果其中一个改变了,另一个也改变了,例如,如果我有一个函数,当我点击元素时,写“hello”,如果我在其中一个元素中这样做,它将反映在两个组件中,我如何实现这一点

提前谢谢


<component #c1 (click)="c2.title = 'hello'"><component>

<component #c2 (click)="c1.title = 'hello'"><component>
有关其他方法,请参见