Skip to content

Conflicting advice regarding host property versus HostBinding and HostListener #59121

@wwjhu

Description

@wwjhu

Describe the problem that you experienced

In https://angular.dev/guide/components/host-elements this advice is given:

Always prefer using the host property over @HostBinding and @HostListener. These decorators exist exclusively for backwards compatibility.

In https://angular.dev/style-guide#style-06-03 this advice is given:

Consider preferring the @HostListener and @HostBinding to the host property of the @directive and @component decorators.

It's either the one or the other.

Enter the URL of the topic with the problem

No response

Describe what you were looking for in the documentation

No response

Describe the actions that led you to experience the problem

No response

Describe what you want to experience that would fix the problem

No response

Add a screenshot if that helps illustrate the problem

No response

If this problem caused an exception or error, please paste it here


If the problem is browser-specific, please specify the device, OS, browser, and version


Provide any additional information here in as much as detail as you can


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions