感谢您的时间和任何帮助 .
我的情况看起来像这样:
Form (
-> Form Field A: extends Abstract Form Field
-> Form Field B: extends Abstract Form Field
...
)
只是在概念上^
我有一个数据集传递到每个字段并绑定到他们的抽象祖先与ngModel的值 .
Those values which are passed in via @Input() are visible and tracked with all updates in the containing "Form" scope
问题是,我需要触发某种onChange事件(类似于angular-1的ng-change),并且这种行为需要抽象地继承(来自共同的祖先字段),因此在模板级别不能使用ngModelChange (在每种情况下被后代覆盖) .
所以tl;博士:
我想要一种方法来传递"this value changed"事件,即使这些更改是对象或数组的子属性(或其他指针级别的更改) .
我想用ng2中的集成方法来做到这一点(类似于我们如何使用ng1中的共享值来处理它 .
我不想像这个问题的另一个答案那样复杂的事件:Angular 2 child component events broadcast to parent
使用手动事件执行此操作是没有意义的,因为值在包含上下文中的变化与子范围一样多 .
Bottomline: How can I get the parent scope to notice when its own values change within one of its child modules?