Angular

Last Updated: 6/19/2023

Aliasing Input Properties

  • For javascript or typescript variables we use camel case approach.
  • In html markup may be you dont wont to use came case notation
  • In property binding you want to use like is-favorite
  • In javascript or typescript hypen is not acceptable identifier
  • The solution is to use alias or nickname for an input property
  • Using alias as another benefit, it keeps the contract of this API stable
  • For refactoring if we change the name of the field. The component is broken. To minimize the impact of these change we can use alias to keeps the contract of this API stable
@Input("is-selected") isSelected: booelan