Input signals are previously referred as input properties.The main job of input decorator is to pass value from parent to child.This will be done by @input decorator.
It is used to transform data from one component to another component.@input is used to pass data from parent component to child component.
similarly using signals we can do it by using input property. Let us understand this by real time code.
Child.component.ts
parent.component.html
<div>
parent
<div>
<app-child [custname]="custname"> <app-child>
parent.component.ts
openchild(){
this.custname="LordNature"
}
Output :
LordNature in child popup.
In child component, you can pass as simply input().Suppose in child component instead of input , if you mention as INPUT.REQUIRED then compulsarily
you need to pass value from parent to child component.
export appchild
{
custname=input.required<string>()
}
Child.component.html
<div>custname()<div>
When you execute the code, If no value passed from parent to child as property.
IT THROWS ERROR IN CONSOLE
RuntimeError: NG0950: Input is required but no value is available yet. Find more at https://angular.io/errors/NG0950
at _ChildComponent.inputValueFn [as custname] (core.mjs:98:19)
custname=input.required<string>()