Skip to content

Combination of HostBinding and signals is not supported (input signals too) #53888

@Celtian

Description

@Celtian

Which @angular/* package(s) are relevant/related to the feature request?

core

Description

I am currentely trying to use new input signal api but I am unable to replace this code with DRY.

  @HostBinding('attr.title')
  @Input({ required: true, alias: 'appModalClose' })
  public closeBtnText!: string;

Proposed solution

Maybe it should be replaced by something like

public closeBtnText = input.required<string>({ alias: 'appModalClose', hostBinding: ['attr.title'] });

Alternatives considered

I was trying to find some solutions, but this is not working

@HostBinding('attr.title')
public closeBtnText = input.required<string>({ alias: 'appModalClose' });
  1. Host is stacked in memory leak
@Component({
  // eslint-disable-next-line @angular-eslint/no-host-metadata-property
  host: {
    '[title]': 'closeBtnText()',
  },
})
export class ModalCloseComponent {
  public closeBtnText = input.required<string>({ alias: 'appModalClose' });
}

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions