@HostBinding and @HostListener: what do they do and what are they for?

前端 未结 7 933
[愿得一人]
[愿得一人] 2020-11-30 16:57

In my meanderings around the world wide interweb, and now especially the angular.io style docs, I find many references to @HostBinding and @HostListener

7条回答
  •  自闭症患者
    2020-11-30 17:37

    Another nice thing about @HostBinding is that you can combine it with @Input if your binding relies directly on an input, eg:

    @HostBinding('class.fixed-thing')
    @Input()
    fixed: boolean;
    

提交回复
热议问题