Angular - Is there list of HostListener-Events?

后端 未结 5 700
鱼传尺愫
鱼传尺愫 2020-12-23 12:28

I am using a hostlistener in a directive to detect \"blur\"- and \"keyup\"-events. Now I need to detect changes in the input-element the directive sits on. I tried

5条回答
  •  既然无缘
    2020-12-23 13:24

    Sorry, I think you ask about a list of properties. You can use e.g.

    @HostListener("focus", ["$event.target"])
      onFocus(target) {
        console.log(target.value)
      }
    
      @HostListener("blur", ["$event.target"])
      onBlur(target) {
        console.log(target.value)
    
      }
      @HostListener("input", ["$event.target.value"])
      onInput(value) {
        console.log(value)
    
      }
    

提交回复
热议问题