Return to site

๐Ÿ…ฐ NEW In Angular: Required for @Input

ยท fullstack

With Angular 16, you can use the {๐‘Ÿ๐‘’๐‘ž๐‘ข๐‘–๐‘Ÿ๐‘’๐‘‘:๐‘ก๐‘Ÿ๐‘ข๐‘’} option for an @๐ผ๐‘›๐‘๐‘ข๐‘ก() decorator to make a property mandatory.

This means that the component will only work if you pass a value for that property.



If the name property of GreetingComponent is not filled, the error message will be something like this:

๐ธ๐‘Ÿ๐‘Ÿ๐‘œ๐‘Ÿ: ๐‘€๐‘–๐‘ ๐‘ ๐‘–๐‘›๐‘” ๐‘Ÿ๐‘’๐‘ž๐‘ข๐‘–๐‘Ÿ๐‘’๐‘‘ @๐ผ๐‘›๐‘๐‘ข๐‘ก() ๐‘“๐‘œ๐‘Ÿ ๐‘๐‘œ๐‘š๐‘๐‘œ๐‘›๐‘’๐‘›๐‘ก ๐บ๐‘Ÿ๐‘’๐‘’๐‘ก๐‘–๐‘›๐‘”๐ถ๐‘œ๐‘š๐‘๐‘œ๐‘›๐‘’๐‘›๐‘ก: ๐‘›๐‘Ž๐‘š๐‘’

#angular #angular16 #requiredInput #programming