简体   繁体   English

Angular Output 通过 emit 发送一个值

[英]Angular Output send one value through emit

I have an Output variable that looks like this我有一个看起来像这样的 Output 变量

@Output() selectedValue = new EventEmitter<{in: any, out: any}>(); 

and I'm setting the values on a change event with我正在设置更改事件的值

this.selectedValue.emit({
  in: event.in,
  out: event.out
})

My question is.我的问题是。 In another part of the app I need to just set the 'in' value and leave the 'out' value alone.在应用程序的另一部分,我只需要设置“输入”值并单独保留“输出”值。 Is this possible?这可能吗?

I couldn't find anything on a search and when I tried to omit the out in the emit it yelled at me.我在搜索中找不到任何东西,当我试图在发射中省略 out 时,它对我大喊大叫。

Please write like this::请这样写::

@Output() selectedValue = new EventEmitter<{ in: any; out?: any }>();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM